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.
cancel
Showing results for 
Search instead for 
Did you mean: 
Caetano
Product and Topic Expert
Product and Topic Expert

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
34 Comments
marianoc
Active Contributor
0 Kudos

Very usefull article!! Thanks Caetano..

0 Kudos

Very helpful, Caetano!

former_member189817
Active Contributor
0 Kudos

Really Good one ! What kind of scenario we can use it ?

Caetano
Product and Topic Expert
Product and Topic Expert

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

former_member184595
Active Participant
0 Kudos

Caetano,

Thanks a lot for sharing ur Exceptional Knowledge. Kudos to ur efforts. :smile:

lloydjs2000
Discoverer
0 Kudos

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

Caetano
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Very useful. Thanks

phantom
Explorer
0 Kudos

Just what I was looking for Caetano, thank you!

Former Member
0 Kudos

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

Caetano
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

Former Member
0 Kudos

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.

 

Caetano
Product and Topic Expert
Product and Topic Expert
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
Former Member
0 Kudos
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

 
Caetano
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello

Check this blog:

https://blogs.sap.com/2013/08/12/badis-for-mrp

Best regards,

Caetano

 
Former Member
0 Kudos
Hello,

Unfortunately, there is no way to update delivery time-spot through MRP for schedule lines.






 

Regards,

MYZ
jdallagnese
Participant
0 Kudos
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!
Caetano
Product and Topic Expert
Product and Topic Expert
Hello

If you want to manipulate the stock quantity there is method CHANGE_MDPSX_MARD.

 

Regards,

Caetano
0 Kudos
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 Kudos
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

 
Caetano
Product and Topic Expert
Product and Topic Expert
0 Kudos
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
former_member458313
Discoverer
Hello,

We are using S/4 Hana 1610 but because of problems with scheduling agreements we are still using the classic MRP. Unfortunately for some reason the BADI MD_CHANGE_MRP_DATA is not called during classic MRP with transaction MD03.

Do you know if we can still using BADI MD_CHANGE_MRP_DATA in S/4 Hana for MRP classic ?

Thanks in advance,

Kalo
Caetano
Product and Topic Expert
Product and Topic Expert
No, it cannot be used in S/4HANA due to the performance optimizations for classic MRP. You should replace it with BAdI MD_ADD_ELEMENTS.
naga_seerla
Explorer
0 Kudos
Hello Caetano,

 

We have implemented MD_ADD_ELEMENTS in S4 1610 On-premise version and it worked well.

However, we are upgrading to 1909 and I noticed that the BADI MD_ADD_ELEMENTS is not triggering.

 

Could you please advise if we need to perform any additional steps to make it work.

 

Thanks,

Naga
bosch_baskar
Discoverer
0 Kudos
Hello,

Very useful, Thank you

We implemented the BADI MD_CHANGE_MRP_DATA to exclude a MRP element. But it will not work, if we run the MRP in " parallel processing": It is not working in both MD01 and WC27 t codes.

Is there any additional thinks to be done?
Caetano
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello Baskar

This BAdI should work with parallel processing active. However, MRP will not stop in your break-points, since it is executed in the update process, in a different server.

Regards,
Caetano
bosch_baskar
Discoverer
0 Kudos

Hello Almeida,

Thanks for the feedback,

It is working fine as expected

jasonjiajhuang
Explorer
0 Kudos
This badi is not effective because it can only exclude the elements not involved in available check
0 Kudos
HI Naga,

 

Were you able to solve this issue? We currently have the same problem.

 

Thanks!
naga_seerla
Explorer
0 Kudos
Hello wolfgangostyn,

 

Yeah, we were able to solve it.

Please create an enhancement from SE19 for the BADI: MD_ADD_ELEMENTS and make sure following are checked:

  • "Active" not switchable in Customizing (IMG)" checkbox is checked under description in SE19

  • "Implementation is active" checkbox under Runtime Behavior is checked

  • SAP Implementation RPM_MD_ADD_ELEMENTS in the BADI MD_ADD_ELEMENTS is having "The implementation will not be called" in Runtime Behavior as this BADI can only have one active implementation.

Hwei
Discoverer
0 Kudos
Hi ,

We use BAdI to exclude some specific sales and purchase documents. It work well with  the purchase document, but I have a problem for the sales document. There is no document number for sales document of  import data CH_COPY_MDPSX ?
Hwei
Discoverer
0 Kudos
We used BAdI MD_ADD_ELEMENTS
sudheerthalari
Discoverer
0 Kudos
Hi Caetano,

 

I have arequirement as below.

 

Plant A receving plant

Plant B issusing Plant

Order qty is 100

 

When there is shortge of item XXX in Plant A after running the MRP system should create a STO PR to plant B.Once the PR is created through MRP in Plant A its converted to STO .

 

Now if Plant B doesnt have stock , Run MRP in plant B its creates a normal PR which gets converted to PO and the stock is received from the vendor.

The PR created in Plant B is picking the qty as per the material master (MRP views) setting in Plant B.

 

I want to know what setting should be done so that MRP in plant B should consider the demand qty from Plant A i.e 100 nos.And PR created in plant B should have linkage wrt to PR Qty from plant A

 

Thanks in advance for your replies

Regards

Sudheer