Entering content frame

Messages in Function Modules and Methods Locate the document in its SAP Library structure

Messages have two different functions in function modules and methods:

Normal Messages

If you use messages in function modules and methods without the RAISING addition in the MESSAGEstatement, and the caller does not catch the message, the message is handled normally according to the context in which it is called within the function module or method.

Triggering Exceptions

If you use messages in function modules and methods with the addition

... RAISING exc

in the MESSAGE statement, the way in which the message is handled depends on whether the calling program handles the exception exc or not.

         If the calling program does not handle the exception, the message is displayed and handled according to the context in which it occurs in the function module or method from which it was called.

         If the calling program handles the exception, the message is not displayed. Instead, the procedure is interrupted in accordance with the message type, and processing returns to the calling program. The contents of the message are placed in the system fields sy-msgid, sy-msgty, sy-msgno, and sy-msgv1 through sy-msgv4 .

Catching Messages in the Calling Program

If messages are sent in function modules without the addition RAISING of the MESSAGEstatement, it is possible to influence message handling through specification of the implicit exception error_message in the EXCEPTION list of the statement CALL FUNCTION. If error_message is specified, the following conditions apply:

         Type S, I, and W messages are ignored (but logged during background processing)

         Type E and A messages trigger the exception error_message

         Type X messages trigger the usual runtime error and short dump.

Catching messages is not currently supported for methods.

 

Leaving content frame