Technical Articles
Add customized message during Idoc outbound processing for output type
It’ll be very helpful to left logs at the Processing log when IDoc outbound been triggered for a specific output type. The standard program already takes care of normal process steps even with generated Idoc number.
What if we want to terminate Idoc output processing due to some failed validations? Take sales order’s EDI user-exit ‘EXIT_SAPLVEDC_004’ as an example, we can throw an exception with ‘DATA_NOT_RELEVANT_FOR_SENDING’.
But it’ll only display ‘No data was selected’ at the processing log which still hard to understand the reason why.
Here we can use the function ‘‘NAST_PROTOCOL_UPDATE’‘ to add logs with screen inactive check to prevent message added at display or preview.
check xscreen = space.
call function 'NAST_PROTOCOL_UPDATE'
exporting
msg_arbgb = syst-msgid
msg_nr = syst-msgno
msg_ty = syst-msgty
msg_v1 = syst-msgv1
msg_v2 = syst-msgv2
msg_v3 = syst-msgv3
msg_v4 = syst-msgv4
exceptions
others = 1.
One place need to pay attention to is: the message ID must be a system message ID instead of customized ID, otherwise will get below C!002 error message.
CHECK screen = space.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = '0D' "syst-msgid
msg_nr = '161' "syst-msgno
msg_ty = 'E' "syst-msgty
msg_v1 = 'Contact Person'"syst-msgv1
msg_v2 = 'missing' "syst-msgv2
msg_v3 = 'feild1' "syst-msgv3
msg_v4 = 'or field2.' "syst-msgv4
EXCEPTIONS
OTHERS = 1.
Finally, get this clear processing log as below:
Thanks for sharing!
Not sure I understand the note about "system message ID instead of customized ID". I've used the FM you've mentioned many times before with either standard or custom message class. Yes, the message needs to be maintained in SE91 but, if I recall, it can be any message.
Could it be that there was simply no message with such number in ZMSG class? I'm not sure where you got that error though, the wording about "work area" is confusing. Hm...
I would caution against reusing random standard messages. We had experience before when a standard message was changed to completely different text. That was quite a surprise to the users after an upgrade. 🙂
Hi Jimmy,
We have similar requirement to this but for INVOIC idocs. We have followed the above mentioned steps, but still the INVOIC IDOC is getting processed, snapshot attached below:
EXIT_SAPLVEDF_002.
Logic:
@Prasad Sadaye
FM: NAST_PROTOCOL_UPDATE is for logs of NAST processing but will not terminate your IDOC processing. Please DO remember to RAISING the exception of your user exit.