Skip to Content
Author's profile photo Caetano Almeida

How to analyze transaction MD04 in debug

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”.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Mariano Cabalen
      Mariano Cabalen

      Once again! Thans a lot Caetano!

      Kind Regards,


      Author's profile photo Nassar fathy
      Nassar fathy

      nice document Caetano

      best regards ➕ 🙂

      Author's profile photo Thiago Felipe Silveira
      Thiago Felipe Silveira


      And for /AFS/MD04? Do you know how I can debug?

      Best Regards.

      Author's profile photo Caetano Almeida
      Caetano Almeida
      Blog Post Author

      Hi Thiago

      I don't have much experience on AFS, but a good starting point is function module  J_3AM_DISPOSITION_DISPL.



      Author's profile photo VASUDEVA NAIDU PUSPALA

      Caetano Almeida,

      Once again thanks for the useful document.....

      very useful document....



      Author's profile photo AMOL NAMJOSHI

      Thanks for sharing the document.