05-18-2007 4:19 PM
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
05-18-2007 4: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
05-18-2007 4: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
07-24-2008 11:55 AM
... turned to classes and class-based exceptions. Issue disappeared.
Regards,
Clemens