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.
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 ...).
Seq | Parameters | IN/OUT | Req | Value 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 |
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 routine meets one of above condition and no data from F41003, then error '0269 - Unit of Measure Conversion Unsuccessful'
- Fetch Data from F41002 - Item Unit of Measure Conversion Factor. Depends on F41001.BUMC - Process UOM Conversions by Branch (from System Constant) the way it Fetch Data from F41002 are different
Example:* 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
SQL> SELECT * FROM PRODDTA.F41002 WHERE ( UMMCU = ' ' AND UMITM = 60020.000000 AND UMUM = 'PL' ) ORDER BY UMMCU ASC,UMITM ASC,UMUM ASC,UMRUM ASCNote:
In searching/fetching data either from F41002 or from F41003:
- Returns both From->To conversion factor and From->Primary conversion factor
- If direct From->To conversion factor does not exist, triangulate it using From->Primary and To->Primary
Supposed that table F41002 contains data as below:
ITM UM RUM CONV CNV1 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