Skip to Content

In some business scenarios, you need to control if an specific planning element will be relevant to MRP or not. For some MRP elements, there is no customizing or master data setting to control that, therefore, SAP delivered BAdI MD_CHANGE_MRP DATA, which allows you to add a custom logic to define the MRP availability of each planning element.

This BAdI is called during the MRP run and on the MRP transactions, such as the stock/requirements list.

On the screenshot below you can see that there is an element PRqRel. This element is MRP relevant, as it is turning the available quantity negative and a purchase requisition was created by MRP to cover it.

md04.PNG

It is a very commomn business requirement to have only stock transfer order (not requisition) releases relevant to MRP on the supplying plant. On this document you will find an example of how this BAdI can be used to make a stock transfer requisition release not relevant to MRP on the supplying plant.

Firstly, open BAdI MD_CHANGE_MRP_DATA on transaction SE18. Clicking the button “documentation” you will find a detailed description of this BAdI.

On tab “interface” you will find a list of all the available methods. There is one method for type of each planning and, since this example is focused on stock transfer requisitions releases, we will use method CHANGE_MDPSX_MDUA.

/wp-content/uploads/2014/10/se18_554124.png

Go to the menu GOTO, SAMPLE CODE and choose the option DISPLAY.

sample code.png

Here, double click the method CHANGE_MDPSX_MDUA.

sample code 2.png

Here you will find a sample code delivered by SAP that makes stock transfer requisitions releases not relevant to MRP (this logic replaces the old modification note 190298). This code will be used as a base for our BAdI implementation.

Get back to transaction SE18 intial screen, choose the menu IMPLEMENTATION and CREATE and choose a name for your BAdI,

/wp-content/uploads/2014/10/implementation_554130.png

On the next screen, write a short text and double click method CHANGE_MDPSX_MDUA, on tab interface. You may be prompted to save and choose a package to your BAdI. You may click the button “LOCAL OBJECT” if you don’t have a package.

Now copy the sample code, make the desired changes and activate your method.

Go back to the previous screen and activate the BAdI. If the BAdI is correctly activated, you will see the text “Implementation is called” on field “Runtime Behavior”.


implementation is called.PNG

Checking the same material from the first screenshot again after the MRP run, we can notice that the purchase requisition was deleted and that stock transfer requisition release does not affect the available quantity anymore.

md04 2.PNG

The same logic can be used on another methods to control the MRP relevance of other planning elements. Basically, field VRFKZ from the internal table CH_MDPS controls the MRP relevance of an MRP element. Besides that, another fields of CH_MDPS can be changed and on the documentation you can find a list of the available parameters. If you don’t want to see the planning element on MD04 you should use the parameter CH_EXIT.

You should consider that this BAdI will be called during the MRP run and a complex logic implemented here may affect the MRP overall performance. Also, changes made on planning elements within this BAdI are not saved on the database, however, they will be considered by MRP, therefore, this BAdI should be used very carefully.

For more details about all the BAdIs available on MRP, see the following document:

BAdIs for MRP

If you are facing any problem with a BAdI on MRP, see the following note:

2012620 MRP: Problems with BAdIs
To report this post you need to login first.

22 Comments

You must be Logged on to comment or reply to a post.

    1. Caetano Almeida Post author

      Hello

      This BAdI can be used on many different scenarios, where you want to make an element (sales orders, reservations, etc…) not relevant to MRP.

      This is specific implementation was suggested as the solution on a thread on the MM space last week, where the user would like to have only stock transfer order releases (not requisitions) relevant to MRP.

      BR

      Caetano

      (0) 
  1. Lloyd Stahlbush

    Caetano,

    Can MD_CHANGE_MRP_DATA be used to include expiring material out in the future?  I looked through the Method options in Interface section but did not see anything for expiry.

    Please advise if this is possible or if you know another way to include expiry in MD04.

    Thank you,

    Lloyd

    (0) 
    1. Caetano Almeida Post author

      Hello Lloyd

      This BAdI can only be used to change existing MRP elements, not to include a new one.

      However, you can use BAdI MD_ADD_ELEMENTS to include a new element on MRP.

      I wrote the following document with the most useful BAdIs on MRP, which may be used for further reference:

      BAdIs for MRP

      Regards

      Caetano

      (0) 
  2. Amulya Punabi

    Hi Caetano,

    We are using SAP 4.6 System and mentioned Badi is not implemented still PRqRel is not creating Planned Orders.Can you suggest Please.

    Thanks

    Amulya

    (0) 
  3. Krishnan S

    Hello Caetano,

    Thanks for a detailed Example on this BAdi. We have a kind of Requirement where we do not want MRP to consider the stock that is less than 1 (In Fraction). For E.g 0.3 M or 0.7M and only consider the stock which is Greater than 1.

    As Advised by R.Brahmankar, We will use this BAdi and the CHANGE_MDPSX_MARD to exclude the Stock of the Materials which is less than 1 and keep you updated on the result.

    Thank you.

    Regards,

    Kris.S

    (0) 
    1. Caetano Almeida Post author

      Hello

      Indeed, method CHANGE_MDPSX_MARD can be used to manipulate the stock available for MRP. I think that it’s just the case of reading the batch stocks from table MCHB and subtract the quantity of batches smaller than one.

      If I can give you one advice is to take care with your logic and avoid selecting too much data, as it may lead to performance issues.

      BR
      Caetano

      (0) 
  4. Mohamed-Yamine Zetti

    Hello Caetano,

    Thanks for this valuable document and the very clear explication.

    I have one question regarding this BADI, it is possible to influence MRP result after an MRP run ? For example, add the time spot to a schedule line or simply increase the procurement proposal quantity ?

    Thank you.

     

    (0) 
    1. Caetano Almeida Post author

      Hello Mohamed

      No, this BAdI is only called when reading the planning elements and the changes made will not be saved on database.

       

      Regards,

      Caetano

      (1) 
  5. Mohamed-Yamine Zetti

    Hello Caetano,

    Please do you have any good idea or solution logic about changing procurement proposales data by the MRP ? We are working with scheduling agreement and we need to maintain delivery time spot according to a specific logic ?

    I performed a lot of research and test but no way to achieve this except using a program that is triggered after the MRP run.

    Best regards,

    MYZ

     

    (0) 
  6. José Henrique Dallagnese

    Hello Caetano,

    Very useful this article!!!

    I was analyzing the BADI MD_CHANGE_MRP DATA, because I have a problem when I send a item for a customer consignment…

    I want that the MRP consider the quantity in customer consignment and don’t generate a new planned order. Is possible to do this with this BADI ?

    Do you know what method can I use?

    Thanks!

    (0) 
  7. ELDOR ELDOR

    Hello Caetano,

    is it possible, by using this BADI, to make the receipt  of  a production order type not relevant for the MRP running but at the same time to take in account requirements for the components?

    We have a special process for the approval of some production tools; so for the special order type OMST we shouldn’t take in account the receipts (all produced finished items will be scrapped) but we need the explosion of the dependent requirements for the semifinished product and for the raw material inserted in the production order BOM.

    Thanks in advance

    Antonio

     

     

     

    (0) 
  8. Pascal RENAULT

    Hi Caetano,

    Very useful, thank you!!

    one question : is there a standard way in MD04 to use a filter on demand in order to hide non MRP relevant elements?

    best regards

     

    (0) 
    1. Caetano Almeida Post author

      Hello

      Yes, you can use a filter to hide the demand in MD04, but then it is only a display feature, which is not relevant during the MRP execution.

      Regards,

      Caetano

      (0) 

Leave a Reply