Making an element not relevant to MRP or MD04 using BAdI MD_CHANGE_MRP_DATA
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.
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.
Go to the menu GOTO, SAMPLE CODE and choose the option DISPLAY.
Here, double click the method CHANGE_MDPSX_MDUA.
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,
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”.
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.
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 |
New NetWeaver Information at SAP.com
Very Helpfull