How to get UOM Conversion Factor

Purpose of Document

The audience for this note is someone with developer level knowledge.

Implementing custom report Unit of Measure (UOM) conversion can be necessary process as each module (Sales Order, Procurement and Manufacturing) may use different Unit of Measure in writing transaction. So this document is to explain possible implementation on this requirement. Currently BSFN B4000520 - GetItemUoMConversionFactor (F41002 Get Item UoM conversion) can be called by other Business Function (For example, XT4111Z1 - F4111EditLine). So this document may be used as a guide on how to implement it and what is considerations in implementing this.

 

Q1> What does BSFN B4000520 - GetItemUoMConversionFactor (F41002 Get Item UoM conversion) do?

To retrieve the Unit of Measure Conversion Factors for an item. This routine will retrieve the conversion factor between the Units of Measure sent in the "From" and "To" units of measure. It will also calculate the quantity using this conversion factor. If the flags are set it will convert the quantity to any Unit of Measure (ie: Volume Weight Secondary ...).

Q2> What are the parameters for this BSFN?

SeqParametersIN/OUTReqValue From/To
1 szBranchPlant IN No Branch Plant
2 szFromUnitOfMeasure IN Yes Transaction UOM
3 szToUnitOfMeasure IN Yes Price/Cost UOM or Primary UOM
4 mnQuantityToConvert IN Yes Transaction Quantity
5 cInventoryInterfaceFlag IN/OUT Yes

If Input value is blank set 'Y' (UDC(H40|IV)

This value is determined by the line type associated. You need to have standard UOM conversion (F41003) when this flag is 'N'.

6 mnConversionFactorFromToPrim OUT   mnConversionFactorFromToPrimry
7 mnConversionFactorFrom_to_To OUT   mnConversionFactor
8 mnConversionFactorTo_to_Primar OUT   mnConversionFactorPriceToPrim (Receipt)
9 mnQuantityConvertedToPrimary OUT   mnConvertedQtyToPrimary
= mnConversionFactorFromToPrim * mnQuantityToConvert
10 cConvertToSecondary (IN)    
11 mnQuantityConvertedToSecondary (OUT)    
12 cConvertToPurchasing (IN)    
13 mnQuantityConvertedToPurchasin (OUT)    
14 cConvertToPricing (IN)    
15 mnQuantityConvertedToPricing (OUT)    
16 cConvertToShipping (IN)    
17 mnQuantityConvertedToShipping (OUT)    
18 cConvertToWeight (IN)    
19 mnQuantityConvertedToWeight (OUT)    
20 cConvertToVolume (IN)    
21 mnQuantityConvertedToVolume (OUT)    
22 cPotencyMode (IN)    
23 szLotNumber (IN)    
24 cPotencyControl IN Yes F4101.OT1Y - Potency Control
25 mnStandardPotency (IN)    
26 szErrorMessageID OUT   Return if it hits error
27 cSuppressErrorMsg IN    set 1 not to stop transaction
28 cPotencyType (IN)   depends on parameter 24
29 mnShortItemNumber IN No Item Number - Short
30 cUOMByBranch IN Yes F41001.BUMC - Process UOM Conversions by Branch
(from System Constant)
31 szUOMToPrimary IN Yes F4101.UOM1 - Unit of Measure - Primary
32 szUOMToSecondary (IN)    
33 szUOMToPurchasing (IN)    
34 szUOMToPricing (IN)    
35 szUOMToWeight (IN)    
36 szUOMToVolume (IN)    
37 szUOMToShipping (IN)    
38 szStandardUOMConversion IN Yes F4101.TFLA - Standard Unit of Measure Conversion
39 mnQuantityConvertedFromtoTo OUT   mnQuantityConvertedFromtoTo

 

Note:

Detail Routine

Q3> How it initialize variables before it returns Conversion Rate and Converted Quantity information?

mnConversionFactorFromToPrim = 1;
mnConversionFactorFrom_to_To = 1;
mnConversionFactorTo_to_Primar = 1;

Array of szConvertUOM[]
szConvertUOM[0] = szUOMToSecondary;
szConvertUOM[1] = szUOMToPurchasing;
szConvertUOM[2] = szUOMToPricing;
szConvertUOM[3] = szUOMToShipping;
szConvertUOM[4] = szUOMToWeight;
szConvertUOM[5] = szUOMToVolume;

cConvertFlag[0] = cConvertToSecondary ;
cConvertFlag[1] = cConvertToPurchasing ;
cConvertFlag[2] = cConvertToPricing ;
cConvertFlag[3] = cConvertToShipping ;
cConvertFlag[4] = cConvertToWeight ;
cConvertFlag[5] = cConvertToVolume ;

 

Note: This is to show this BSFN B4000520 can handle other type of conversion by setting proper flags.

Q4> How it does validate Input Values?

mnConversionFactorFromToPrim = 1
mnConversionFactorTo_to_Primar = 1
mnQuantityConvertedToPrimary = mnQuantityToConvert
mnQuantityConvertedFromtoTo = mnQuantityToConvert
* Zero Input short item number
* Non inventory item
* F4101.TFLA - Standard Unit of Measure Conversion is set to 1
* If cUOMByBranch = Y, then Fetch F41002 with ITM, MCU, UM, & RUM
* else Fetch F41002 with ITM, UM, & RUM
* Return cnv1 - Conversion Factor - Secondary to Primary, conv - Conversion Factor
                Example:
                SQL> SELECT * FROM PRODDTA.F41002 WHERE ( UMMCU = ' ' AND UMITM = 60020.000000 AND UMUM = 'PL' ) ORDER BY UMMCU ASC,UMITM ASC,UMUM ASC,UMRUM ASC
Note:
In searching/fetching data either from F41002 or from F41003:

Supposed that table F41002 contains data as below:
ITMUMRUMCONVCNV1
60020 PL EA 10.0000000 10.0000000

Compute Conversion Rate and Quantity based on UoM Conversion Rate:
MathDivide(lpmnFromToConv, &mnRemainder, &dsF41002FromPrim.umcnv1,
                                    &dsF41002ToPrim.umcnv1, &nDecimals, &nRoundFlag) ;
Explanation:
Or lpmnFromToConv = (&dsF41002FromPrim.umcnv1 / &dsF41002ToPrim.umcnv1) + &mnRemainder
lpmnFromToConv = round (lpmnFromToConv, 20)

Example:
MathDivide(lpmnFromToConv, &mnRemainder, 10.0000000, 1.0000000, 20, 0)
lpmnFromToConv = round ((10.0000000/1.0000000) + 0), 20) = 10.0000000

Q5> What are common errors come during getting UOM Conversion Rate?

To discuss information further with Oracle experts and industry peers, we encourage you to review, join or start a discussion in the JDE1 Distribution Community.

To look at upcoming or archived Advisor Webcasts please see Advisor Webcast Details (Doc ID 548764.1) if your topic is not currently scheduled please suggest it.