Documente Academic
Documente Profesional
Documente Cultură
14-07-13
Markus Wolf
14-07-13
ME21N (MEPO).................................................................................................................4
Base unit.......................................................................................................................................................4 Order unit......................................................................................................................................................4 Quantity........................................................................................................................................................5 Rounding.......................................................................................................................................................5 Conversion factor for order unit...................................................................................................................7 Weight and volume.......................................................................................................................................7 Points............................................................................................................................................................8 Price unit.......................................................................................................................................................8 Conversion factor for price unit....................................................................................................................8
Debugging...........................................................................................................................9
SAPMM06E.................................................................................................................................................9 MEPO...........................................................................................................................................................9
14-07-13
Introduction
The unit determination in purchasing is a bit complicated as the units used for ordering and the conversion factors can come from many sources. The main sources are the material master and the purchasing inforecord.
ME21 (SAPMM06E)
The sequence in which the different variables are determined is as follows:
Base unit
The base unit is retrieved from the material master. If there is no material in the current item, the unit stays empty (routine determine_lmein).
Order unit
At first it is checked if variable order units are allowed (material master, inforecord, sub-item). If a unit has been entered manually and variable order units are allowed, this unit is used. If not, the system tries to determine a unit automatically (routine determine_meins). For this the following documents are searched through for units: 1. Reference document (PO is copied to another PO) 2. Contract 3. Request for quotation 4. Purchasing requisition (order unit, if maintained) if variable order units are allowed 5. Purchasing inforecord 6. Purchasing requisition (order unit, if maintained) 7. Purchasing requisition (requisition unit) 8. Material master (order unit) 9. Material master (unit of issue) 10. Material master (base unit) 11. For service lines it is determined with the function MS_READ_UNIT
Quantity
To determine the quantity that will be used in the PO, we try to determine the quantity and the related unit from the document to which we are referring when creating the PO and then convert this quantity into the order unit (routine determine_menge). For this conversion we first check if a different conversion factor is defined in the inforecord, in a related customer order or a batch (routine unit_from_sd_batch) or in the customizing (e.g. the factor between kg and to). The order and the batch have priority over the inforecord. If such a factor is found, this conversion factor is used, if not the conversion factor is determined by the function ME_CONVERSION_BPRME that tries to get the factor from the material master.
Rounding
If we are entering new data, rounding is performed next (routine determine_round). This can change the quantity and the order unit. If a rounding happens and no one knows why, it is usually a good idea to check the following entries: Inforecord (Purchasing Organization Data 1) o Minimum quantity o Rounding Profile Material master (MRP1) o Minimum lot size 3
14-07-13
o Rounding Profile o Rounding value Decimal places for rounding (in the customizing: General Settings -> Check units of measurement -> Units of measurement -> Details)
Points
Points are used in for the calculation of rebates at the end of a period. The points are retrieved from the reference document, a RFQ, a contract or an inforecord (routine determine_anzpu).
Price unit
The price unit is initially filled with the order unit (if no value as been entered manually)(routine determine_bprme). It will be overwritten when the pricing is performed.
ME21N (MEPO)
Base unit
The base unit is retrieved from the material master. If there is no material in the current item, the unit stays empty (routine mepo_item_fill_lmein).
Order unit
At first it is checked if variable order units are allowed (material master, inforecord, sub-item). If a unit has been entered manually and variable order units are allowed, this unit is used. If not, the system tries to determine a unit automatically (routine mepo_item_fill_meins). For this the following documents are searched through for units: 1. Reference document 2. Contract 3. Request for quotation 4. Purchasing requisition (order unit, if maintained) if variable order units are allowed 5. Purchasing inforecord 6. Purchasing requisition (order unit, if maintained) 4
Units and rounding 7. 8. 9. 10. 11. Purchasing requisition (requisition unit) Material master (order unit) Material master (unit of issue) Material master (base unit) For service lines it is determined with the function MS_READ_UNIT
14-07-13
Quantity
To determine the quantity that will be used in the PO, we try to determine the quantity and the related unit from the document to which we are referring when creating the PO and then convert this quantity into the order unit (routine mepo_item_fill_menge). For this conversion we first check if a different conversion factor is defined in the inforecord, in a related customer order or a batch or in the customizing (e.g. the factor between kg and to). The order and the batch have priority over the inforecord. If such a factor is found, this conversion factor is used, if not the conversion factor is determined by the function ME_CONVERSION_BPRME that tries to get the factor from the material master.
Rounding
If we are entering new data, rounding is performed next (routine mepo_item_fill_round). This can change the quantity and the order unit. If a rounding happens and no one knows why, it is usually a good idea to check the following entries: Inforecord (Purchasing Organization Data 1) o Minimum quantity o Rounding Profile Material master (MRP1) o Minimum lot size o Rounding Profile o Rounding value Decimal places for rounding (in the customizing: General Settings -> Check units of measurement -> Units of measurement -> Details) If rounding happens and this is ok in principle, but nobody understands the result: set a breakpoint in include LMPOEF65, form mepo_item_fill_round where the function module MD_SINGLE_ROUNDING is called. Check that the quantity right before the call (field ls_general-menge and ls_general-meinh) is what the user has entered. Keep in mind the qty right after the call (ls_results-lmenge and ls_results-logme, ls_results-menge and ls_results-meins). Set one more breakpoint where ME_PROOF_VARIABLE_ORDERUNIT is called (always inside mepo_item_fill_round). Two cases: 1) ME_PROOF_VARIABLE_ORDERUNIT comes back with sy-subrc = 0: if the result on the PO is what you can see in ls_results-lmenge and ls_results-logme -> forward the message to component LO-MD-QO 2) ME_PROOF_VARIABLE_ORDERUNIT comes back with sy-subrc ne 0: if the result on the PO is what you can see in ls_results-menge and ls_results-meins -> forward the message to component LO-MD-QO Rounding takes place just once and should be seen as a proposal from the system. As soon as rounding takes place the user will be informed about this by message ME 386 (customizable). If the user disagrees with the proposal, he can change the qty manually and there will be no more rounding afterwards. A second rounding for the same PO item can just take place if: the rounding profile has changed or the material has changed or an error came up during the last attempt to do rounding or 5
14-07-13
Rounding can just take place if there has been entered a material for the PO item (no text lines, no services, ..) whereby the existence of an external material number (ekpo-ematn) is sufficient (it could be an MPN material for which rounding should be done).
customizing
Logistics General->Quantity Optimizing and Allowed Logistics Units of Measure, 6
14-07-13
maintain rounding profiles: you can maintain static and dynamic rounding profiles, per plant or plant independent. As of release 4.7 there is another customizing issue: Control for Quantity Optimizing (same path as above). You can create control profiles which define on a very detailed level which activities/functionalities are desired or should not be done during the rounding process. This is a much clearer way of definition as it was done before (by material master data and info record data which can overlap). The control profile can be assigned to the calling application and transaction code.
user-exit
We will never manage to satisfy all of our customers' wishes in terms of rounding. For that reason there is a user-exit integrated into MD_SINGLE_ROUNDING where the customer can implement his own rounding mechanism -> see note 301105.
14-07-13
weight and volume are retrieved from the material master for the base unit and a recalculation is done by using the conversion factor.
Points
Points are used in for the calculation of rebates at the end of a period. The points are retrieved from the reference document, a RFQ, a contract or an inforecord (routine mepo_item_fill_anzpu).
Price unit
The price unit is initially filled with the order unit (if no value as been entered manually)(routine mepo_item_fill_bprme). It will be overwritten when the pricing is performed.
FORM PREISFINDUNG_UEBERNAHME. READ TABLE TKOMV WITH KEY KPOSN = EKPO-EBELP BINARY SEARCH. "@109886 IF SY-SUBRC EQ 0. "@109886 DATA: L_TABIX LIKE SY-TABIX. "@109886 L_TABIX = SY-TABIX - 1. "@109886 DO. "@109886 L_TABIX = L_TABIX + 1. "@109886 READ TABLE TKOMV INDEX L_TABIX."@109886 IF ( SY-SUBRC NE 0 ) OR ( TKOMV-KPOSN NE EKPO-EBELP )."@109886 EXIT. "from do"@109886 ENDIF. "@109886 CHECK ( TKOMV-KNTYP EQ 'H' OR TKOMV-KNTYP CA 'GST' )."@109886
^^^^^^^^^^^^^^^^^^^^^
14-07-13
Debugging
If the behaviour of the quantity conversion/unit determination is somehow suspicious and cannot be easily explained, its a good idea to set breakpoints before the affected routines (especially the rounding-routine) and see where the values get strange. If the rounding from within MD_SINGLE_ROUNDING does not work correct, the message should be forwarded to the component LO-MD-QO.
SAPMM06E
In SAPMM06E the breakpoint should be set in NEUE_POS_ANFRAGE, NEUE_POS_BESTELLUNG or NEUE_POS_RAHMENVERTRAG before calling DETERMINE_LMEIN.
MEPO
In the function-group MEPO the breakpoint should be set in MEPO_ITEM_FILL before calling the routine MEPO_ITEM_FILL_LMEIN.
Open point
There is still an open point at the moment concerning conversion-factors defined in SD-orders/batches in combination with rounding as the rounding function MD_SINGLE_ROUNDING does currently not handle these.
Notes
Too many to count. Rounding: 401437 386240: User Exit in rounding function 303613 Handling of batches: 490331 390242 Redesign quantity conversion: 357864 350006 339057 338457 322391 321862 315310 313068 309124 308526 306980 306070 301550 300799 187511 9
14-07-13
Appendix
Interesting fields Purchasing document
In the purchasing document we have the following fields: EKPO-MEINS: order unit EKPO-BPRME: price unit EKPO-LMEIN: base unit EKPO-UMREZ, EKPO-UMREN: conversion from order unit to base unit EKPO-BPUMZ, EKPO-BPUMN: conversion from order unit to price unit
If you want to calculate the ordered quantity in base unit: X = EKPO-MENGE * EKPO-UMREZ / EKPO-UMREN If you want to calculate the ordered quantity in price unit: X = EKPO-MENGE * EKPO-BPUMZ / EKPO-BPUMN
Inforecord
In the inforecord we have fields in EINA and EINE: EINA-MEINS: order unit EINA-LMEIN: base unit EINA-UMREZ, EINA-UMREN: conversion from order unit to base unit EINE-BPRME: price unit EINE-BPUMZ, EINE-BPUMN
If you want to convert a quantity from order unit into base unit: X = Y * EINA-UMREZ / EINA-UMREN If you want to convert a quantity from order unit into price unit: X = Y * EINE-BPUMZ / EINE-BPUMN
Conditions
In the table KONP we have the condition unit (whoch usually is the same as our price unit) and a field that is called base unit but really contains our order unit: KONP-KMEIN: condition unit (usually our price unit) KONP-MEINS: order unit (even if it is called base unit) KONP-KUMZA, KONP-KUMNE: conversion between KMEIN and MEINS
If you want to convert a quantity from condition unit into the order unit X = Y * KONP-KUMZA / KONP-KUMNE
10