这里的EXCEPTIONS我的理解是:
系统默认的有个捕捉异常机制,后台会相应的处理,也就是说这里不开异常,系统后台也会自行处理
这里的异常可能是捕获,让自己进行处理,如果自己不处理,让系统后台会自行处理.
相应的消息type,后台会不同的对待,详细看on line help
Using EXCEPTIONS, return values can be assigned to non-class-based exceptions exc1 exc2.... Syntax and meaning of the addition are the same as for CALL METHOD - with the exception that a predefined exception error_message can be specified here. If no exception occurs, a function module call sets sy-subrc to 0.
If the error_message addition is specified after EXCEPTIONS, all MESSAGE statements that are executed during the processing of the function module and do not have the RAISING addition are affected as follows:
- Messages of the type S, I, or W are not sent during background processing, but noted in the log.
- Messages of the type E and A trigger the exception error_message and set sy-subrc to n_error. The message class, message type, message number, and the contents of possible placeholders for the MESSAGE statement are in the fields sy-msgid, sy-msgno, sy-msgty, and sy-msgv1, ... , sy-msgv4. With messages of the type A, the ROLLBACK WORK statement is also explicitly executed.
- Messages of the type X are not influenced. As always, they cause program termination with a short dump.
If the RAISING statement is specified in a MESSAGE statement within the function module and a return value is assigned to the corresponding exception exc1 exc2..., sy-subrc is set to this value. If no return value is assigned to the exception after RAISING, the message is influenced, as described above, by the error_message addition.
As of Release 6.10, function modules can pass on class-based exceptions if exception classes are specified in the Function Builder. In this case, the EXCEPTIONS addition must not be specified.
Notes
- For the message handling with the predefined exception
AB>error_message, it does not make a difference if the message is
sent in the currently called function module or in one that is called
by this function module. Contrary to the exceptions that are triggered
by the statement RAISE, messages sent using the statement MESSAGE are propagated across calling levels.
- You can omit the specification of the return value = n after a specified exception when using CALL FUNCTION. If an exception is raised, the value 1 is assigned to sy-subrc. We recommend to specify the return value explicitly.