Monday 13 July 2009

Exception handling when calling a FUNCTION MODULE

Sometimes coding (in transfer rules, transfer routines (on infoobjects) or update rules) can cause problems due to invalid exception handling of function module calls. When calling a function module (eg. READ_TEXT) always enable the EXCEPTIONS part of the function call, otherwise a shortdump will occur.
(When, in the coding of the function module, an exception is raised)

In the coding of function module 'READ_TEXT', an exception is raised, for example, when a text can not be found (In this case exception NOT_FOUND will be raised)

This exception (NOT_FOUND) which is 'raised' by the function module (READ_TEXT), will be passed back to the 'caller'.
('caller': the abap which 'calls' the function module. Eg. a transfer rule or an update rule)
As the caller cannot handle the exception which is 'passed back' by the function module call, a shortdump occurs!

Conclusion:
Always enable the EXCEPTIONS PART when calling a FUNCTION MODULE !

No comments:

Post a Comment