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:

md04-1.PNG

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

/wp-content/uploads/2014/11/md04_2_590218.png

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

/wp-content/uploads/2014/11/md04_3_590219.png

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.

md04-5.PNG

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

md04-4.PNG

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

SE11.png

Assigned Tags

      6 Comments
      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,

      Mariano

      Author's profile photo Nassar fathy
      Nassar fathy

      nice document Caetano


      best regards ➕ 🙂

      Author's profile photo Thiago Felipe Silveira
      Thiago Felipe Silveira

      Hi,

      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.

      BR

      Caetano

      Author's profile photo VASUDEVA NAIDU PUSPALA
      VASUDEVA NAIDU PUSPALA

      Caetano Almeida,

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

      very useful document....

      Regards

      Pushpala

      Author's profile photo AMOL NAMJOSHI
      AMOL NAMJOSHI

      Thanks for sharing the document.