Skip to Content

Exception handling

Hi,

in a classical userexit we have just one include to put in the coding.

I want to call a newly-created function function in this include. The function is a copy of the customer-function where the include is located in.

How can we achieve that exceptions raised are passed to the calling function?

Example:

function exit_saplv55k_004 .
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       EXPORTING
*"             VALUE(PROCESSING_PROTOCOL) TYPE  DELIF_T_PROTT
*"       TABLES
*"              IDOC_DATA STRUCTURE  EDIDD
*"       CHANGING
*"             VALUE(IDOC_CONTROL) LIKE  EDIDC STRUCTURE  EDIDC
*"       EXCEPTIONS
*"              IDOC_ERROR
*"              DO_NOT_PROCESS_IDOC
*"----------------------------------------------------------------------


include zxtrku12 .


endfunction.
--
*&---------------------------------------------------------------------*
*& Include.: ZXTRKU12                                                  *
call function 'Z_EXIT_SAPLV55K_004'
  importing
    processing_protocol = processing_protocol
  tables
    idoc_data           = idoc_data
  changing
    idoc_control        = idoc_control
  exceptions
    idoc_error          = 1
    do_not_process_idoc = 2
    others              = 3.

Are the exceptions passed to the calling function? How to achieve this, how to raise OTHERS?

TIA,

Regards,

Clemens

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 18, 2007 at 03:49 PM

    Hi,

    You have to check for each subrc value and raise the exception the accordingly..

    As the exception is not getting carried over to the calling function..

    For others I believe you don't have to do anything..

    Also if you put where used list of the exit function module...The exceptions are not handled...Meaning the exceptions are given..But after the FM call they are checking for the values in the importing parameter PROCESSING_PROTOCOL...Not checking for sy-subrc value..

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 18, 2007 at 03:51 PM

    You need to check sy-subrc ,

    Function module returns sy-subrc ,based on ur exception ,it will return sy-subrc.

    idoc_error = 1

    do_not_process_idoc = 2

    others = 3.

    Here idoc_error ,this means sy-subrc eq 1

    do_not_process_idoc is sy-subrc eq 2.

    So use your validation within ur include program like

    case sy-subrc.

    when '1'.

    message

    when '2'.

    message

    when others.

    message.

    endcase.

    Reward Points if it is helpful

    Thanks

    Seshu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 24, 2008 at 10:55 AM

    ... turned to classes and class-based exceptions. Issue disappeared.

    Regards,

    Clemens

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.