When doing goods receipts for Scheduling Agreement (SA), the delivery tolerance is related to the delivery date of the schedule line. Sometimes you are confused how it works and how you could control it. Common problems are when running goods receipts for the SA, system proposes no item or system prompt M7021 error.
This is a problem I received from many customers who are using MM module. The problem itself is not complicated, but there are several SAP notes involved which makes it little bit confusing sometime. You will sometimes wonder what is the system design and what should I do. So let us take a look at this.
Firstly I would like to list the history changes on this funtionality:
- At the stone age, the system behaves like this, the open quantity is calculated based on the current date and the schedule line dates. If there is no open quantity up to current date, there is no quantity proposed in GR (MIGO/MB01), and the over delivery tolerance is refer to the open quantity, and is NOT as the setting in the PO item. This is described in SAP note 53161 and 76901.
PO item over delivery tolerance 10%
Schedule quantity GR quantity
2008.01.01 10 EA 10 EA
2008.02.01 20 EA 20 EA
2008.03.01 30 EA 30 EA
2008.04.01 40 EA 0 EA
2008.05.01 50 EA 0 EA
2008.06.01 60 EA 0 EA
Current date 2008.03.20. There is no open quantity, in MIGO/MB01 there is no quantity proposed; if set “proposed all” in MIGO/MB01, still no further GR is possible, because no over delivery tolerance
Since the old system design can not meet every customer’s requriement, an user exit was introduced through SAP note 70426.
SAP enhancement MEVME001/EXIT_SAPLEINR_001
POT = order item data.
CETT = schedule lines per item
F1 = Quantity to be proposed + total of the quantity that is already delivered (the quantity that is already delivered is subtracted again before the output of the proposed quantity on the screen)
F2 = Quantity to which the tolerance calculation refers to
How to use this user exit is explained in below SAP notes:
SAP Note 78404
The open quantity up to the current date is proposed (F1). The maximum quantity that you can enter is the quantity scheduled in total plus the quantity scheduled in total multiplied by the tolerance value (F2) minus the already received quantity of goods received. For the lower limit, the proposed quantity minus the proposed quantity multiplied by the tolerance value (F2) is set.
SAP Note 105169
2. Goods receipt to the scheduling agreement: basically, the system proposes the open quantity until the current date, thus the scheduled quantity until the current date minus the quantity of goods. For scheduling agreements with release documentation, the open quantity is determined on the basis of the quantity known to the vendor. Thus, the last transferred release is taken as a basis. For the overdelivery tolerance, the whole scheduled quantity is multiplied with the percentage rate possibly maintained. If you activate the user exit, the percentage rate refers to the quantity ‘F2’ which is determined in the user exit. In general, for the underdelivery tolerance it is valid that the percentage rate refers to the proposed quantity or ‘F2’ from the user exit. In order to adjust the default quantity customer-specifically a user exit is available (enhancement MEVME001, see Note 70426).
The system logic was changed by SAP note 708973 as below:
Before this note: if EXIT_SAPLEINR_001 is active the open quantity is F1; if EXIT_SAPLEINR_001 is not active the open quantity up to current date; the over delivery tolerance is the total quantity + total quantity * F2%.
As of this note, the over delivery is open quantity + open quantity * F2%, i.e. no longer possible to do GR for schedule lines in future dates.
Some users were not satisfied with note 708973, because they can not do GR for schedule lines in future dates. So the user exit EXIT_SAPLEINR_001 was extended further by SAP Note 737495:
Parameter name Optional Pass value Short text
F3 X X Underdelivery quantity
F4 X X Overdelivery quantity
Thus we could use the solution in SAP note 741385:
f4 = ls_ekpo-menge + ls_ekpo-menge * ls_ekpo-uebto / 100.
Thus the over delivery quantity again is total quantity + total quantity * tolerance. Please pay attention, this is regarding to over delivery quantity (M7021 M7022 error), not open quantity (proposed quantity in MIGO/MB01), means you have to set “propose all” if there is no open quantity. Only when there is open schedule line till current date, there will be proposed quantity in MIGO, unless you set F1 in EXIT_SAPLEINR_001
Why should I review the history of all those notes? Because you might be at R/3 release 46C or 470, or ERP ECC 500, or at different package levels…. You sometimes are confused which note should I refer to and How system works. Now I think you will not be surprised when doing GR for SA there is M7021 error or no items are proposed by system.
Another very useful SAP note is 874264 which contains information about how to debug the determination of the proposed quantities during GR:
To debug the determination of the proposed quantities, set a
breakpoint in the XEBEFU_AUFBAUEN subroutine in the
ME_READ_ITEM_GOODS_RECEIPT function module. The corresponding
include is called LEINRF2K. This subroutine is executed for all
goods movements for a purchasing document.
In addition, in the case of subsequent and cancellation postings,
consider the subroutines WE_AUS_BETS (include LEINRF2B) for items
without GR-based invoice verification and WE_AUS_BETZ (include
LEINRF2A) for items with GR-based invoice verification.
Example coding of user exit EXIT_SAPLEINR_001:
*& Include ZXM06U28
* > Local Data – Start
DATA: LS_EKPO LIKE EKPO.
DATA: LS_EKET TYPE EKET,
LV_OVERDEL_DAT TYPE DATUM,
LV_MENGE TYPE ETMEN.
* > Local Data – End
* > POT includes the current item row
MOVE POT TO LS_EKPO.
F4 = LS_EKPO-MENGE + LS_EKPO-MENGE * LS_EKPO-UEBTO / 100 .
* > Set overdue to current date + one week
LV_OVERDEL_DAT = SY-DATUM + 7.
* > CETT includes all records from eket
* > The program summerizes amounts for its rows within the defined
period (week ahead)
LOOP AT CETT INTO LS_EKET WHERE EBELP = LS_EKPO-EBELP AND
EINDT <= LV_OVERDEL_DAT.
LV_MENGE = LV_MENGE + ( LS_EKET-MENGE – LS_EKET-WEMNG ).
F1 = F1 + LV_MENGE.
The overdelivery tolerance is as the total quantity of SA plus overdelivery LS_EKPO-UEBTO
The proposed quantity in MIGO is the open quantity within current date + 7.