Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert

The stock/requirements list (transaction MD04) displays all the MRP relevant documents and is builded with information from many different tables, belonging to different application areas (PP, MM, SD, QM, etc). Sometimes we don't know exactly where a planning element is comming from or why is it displayed with a certain quantity or on a certain date. In these cases, the only way to resolve the issue is to analyze MD04 in debug.

The starting point to analyze MD04 in debug is function module AUFBAUEN_MDPSX_ANZEIGEN. Here, all the customizing, master data and planning elements are read from the database, therefore, we should set a break point o the beginning of this function module.

Initially, system reads the material master settings and MRP customizing (both methods of BAdI MD_MRP_PARAMETERS are called here), on the following piece of code:

After that, for each kind of planning element there is an specific SELECT form, like SELECT_PLAF, SELECT VBBE, etc…:

Inside the SELECT forms, we will find the select statements where the planning elements are selected from database:

When a record is found on the database, a PRUEFEN form (PRUEFEN_PLAF, PRUEFEN_VBBE, PRUEFEN_RESB…) is called to validate, check and adjust the record. If this record is relevant to MRP, it will be inserted into the internal table MDPSX at the end of the PRUEFEN form. BAdI MD_CHANGE_MRP data is also called here, to make a possible adjustment of this planning element.

After all the SELECT forms, there is the code related to forecast, sorting and PIR consumption. Note that BAdI MD_ADD_ELEMENTS is called here.

At the end of this function module, MDPSX will contain all the MRP elements that will be displayed on MD04:

Besides AUFBAUEN_MDPSX_ANZEIGEN, the following function modules may also be useful:

  • MD_GET_KUND: Read customer information for sales orders;
  • MD_GET_LIEF - Read vendor information;
  • MDEZX_AUFBAUEN – Build the MRP elements texts, as they are displayed on the screen;
  • MDSUX_AUFBAUEN - Buld the MD04 period totals;

NOTE: Some of these selects are made on transparent tables, such as PLAF, RESB or VBBE. However, some selects are made on views created specifically for MRP (especially the MM planning elements, such as purchase orders or scheduling agreements). This is the case of MDBS, MDLA, MDUB, etc... For more details about these views, you can open them on transaction SE11 and check the “table/join conditions” and the “selection conditions”.