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: