2021 Jun 24 5:00 AM
Hi All,
We need to implement the BAdI ME_PROCESS_REQ_CUST as recommended in the SAP note 2618264.
Does anyone have an example code to implement the logic that the note says?
How can we change the message type of a standard message already raised, in the BAdI that's called after the said message is triggered?
Alternatively, how do we detect if this specific message is already in the log? If we can do that, then can remove the same, and raise again using mmpur_message_forced macro with a different message type.
PS. This is a S/4HANA 2020 FPS01 system.
2021 Jun 24 5:02 AM
Also not sure if this logic goes into the PROCESS_ITEM method or into PROCESS_ACCOUNT method?
2021 Jun 24 6:32 AM
Go in SE18, display the BADI, go in the Interface TAB and there is a class example
2021 Jun 24 6:46 AM
Hi Frederic,
It'd be highly appreciated if you read and understand the question before answering. Also, you might want to take a look at the almost empty and useless example class CL_EXM_IM_ME_PROCESS_REQ_CUST, that doesn't serve practically any purpose to help anyone.
2021 Jun 24 7:18 AM
This is a great answer to someone that take free time to try to help people.
I did not read the oss note for you, and maybe if you take time to explain what is inside this note it could help.
Personaly this example was enough for me to understand & use this BADI.
I hope, as you have a so high requirment level, that you will apply it to your work and research.
Good luck in the ABAP Jungle.
2021 Jun 24 10:53 AM
Indeed Frederic. Just FYI, I'm already 18yrs in the ABAP Jungle. And have done almost 2 days of research before asking a question here. 😉
All the basics are covered. Even this particular BAdI, I've implemented many times. But never got this type of a requirement, unfortunately.
2021 Jun 24 10:33 AM
You can check the 2666809 - How to identify PO/PR with items created from catalog for identify whether items created from catalog or not.
Base on that criteria, you can create your own logic via BADI ME_PROCESS_REQ_CUST method PROCESS_ITEM when message 06334 should be error or not because you already configured message 06334 as warning in transaction OLME > Environment Data > Define Attributes of System Messages.
Example, if items was not created from catalog then message 06334 should be error.
2021 Jun 24 10:50 AM
Thanks for the Note, Andy!
As I debugged the process I see that the message 06334 is actually triggered before this BAdI is called, and as per the OLME customizing, it's already in the list. So I'm not sure how can we now 'decide' in the BAdI to make it error or warning, based on any criteria.
As a check, I created an implementation and simply added the message 06334 as 'W' in the PROCESS_ITEM method (without any other logic), using mmpur_message_forced. Then upon running, I see both the messages ('E' and 'W') in the message list.
So it means the decision about the message is already made before the BAdI is called. 😞
2021 Jun 24 11:09 AM
BTW, just to add to your answer, Andy.
The note you provided is helpful for ECC system, however, in S/4 HANA SAP has already added helpful fields in EBAN to determine if the item is added from a catalog:
So I believe that part is covered. I'm basically stuck on how to make the message from error to warning conditionally.
2021 Jul 01 5:27 AM
You already configured message 06334 as warning in transaction OLME > Environment Data > Define Attributes of System Messages as per SAP note 2618264.
So, in BAdI ME_PROCESS_REQ_CUST method PROCESS_ITEM, your code will make error for message 06334 in specific condition, eg: if PR is not from catalog.
2021 Jun 24 10:49 AM
Don't change the already raised message, that's not easy (or search for mmpur_remove_messages_by_id or threads/questions on 'Handling Errors in Purchase Requisition' but most are removing customer message not standard one) and it's much harder on PR than on PO)
I would rather suggest to use the Customizing option to always ignore the error in the standard and then build your own logic in a BAdI implementation, raise the error with your own business rules.
NB: Look at the data you can get (IM_ITEM->GET_DATA) in PROCESS_ITEM. is the PIR field is available, so you have your second answer.
2021 Jun 24 11:02 AM
Yes, unfortunately the (easy) customizing option is already ruled out by the note itself (I've updated the question with a screenshot from the note).
For this specific scenario the 'easy' options are out of the window already. mmpur_remove_messages_by_id would remove all the messages, which we don't want to do. mmpur_remove_msg_by_context is a better option to remove individual messages.
Yes, I'm aware that these macros are used only for custom messages, and I've used it for the purpose too. But in this case, that seems to be the only option. I've debugged and found the context number for the standard message. However, cannot figure out the 'ID'.
Moreover, before this, Somehow I'll also need to figure out if the message is even raised by Std in the first place.
2021 Jun 24 11:23 AM
Try to disable the message in Customizing though, the note can be interpreted in different ways. Perform a test: Does the error message disappear: always, when created from catalog only, when not created from catalog?
2024 Feb 08 10:21 PM - edited 2024 Feb 08 10:22 PM
I know it's "a bit" late, but for yourself and any new readers who come across this like I did when searching for solutions to one of my own problems:
You can use CL_MESSAGE_HANDLER_MM method HAS_SIGNATURE to check if the message has been issued already. See how SAP does it in their own code in include MM06EF0L_LESEN_BELEG form LESEN_BELEG.