This page is created to clarify the application logic of report ZZ_CORR_EKET_WEMNG_WAMNG_GLMNG.
Using this debugging guide, you can see, how the correction report should work. If the report doesn't correct the document or provide unexpected result, you can use this guide to find the cause.
To determine the relevant report, always refer to KBA 2044484.
In FORM REPAIR_QUANTITIES, system gathers the item data of the document to verify whether the item is a return or subcontracting item. In these cases the report will skip the item.
Then system calculates the total of:
- Received Quantity
- Issued Quantity
- Delivered Quantity
System appends these values for all lines into table XERROR.
Then system loops at this table and stores these values into the corresponding variables HWEMNG, HWAMNG and HGLMNG. Then it selects each schedule line and calls FORM RECALC to redistribute the calculated values.
In FORM RECALC system redistributes the calculated total values into the EKET lines. Until the total value is greater than the scheduled quantity, system fills the corresponding field (WEMNG, WAMNG, GLMNG) up to the quantity of the schedule line and reduces the total. If the total is less than the scheduled quantity, system fills the value itself. This logic is the same for all three fields. In the screenshot below you can see the logic for WEMNG.
Afterwards system returns FORM REPAIR_QUANTITIES. If there is still quantity that couldn’t be distributed, system adds that into the last schedule line.
Finally, system updates the database in FORM SHOW.