We can help. Together we learn....

Suppose we have a standard SAP function module issuing an error message because of invalid input data. Now if we are calling this function module from any custom conversion program and such an error message is issued by the function module, the entire processing would stop and program would terminate displaying this error message. In case of a background job, it would also show an error and abruptly stop.

In order to handle such scenarios, we can provide an additional parameter in the function module exception called 'ERROR_MESSAGE' and give a sy-subrc value to it. This should be before the normal OTHERS parameter.

Now when the error is issued in the function module, the program doesn't terminate immediately. But the SAP function module returns with the SY-SUBRC value corresponding to the ERROR_MESSAGE exception.

Also the error message details can be found in the standard system message fields (SYST structure) and can be used by the custom program to populate any processing log / report.

Categories