‎2006 Aug 10 10:34 AM
There is a Function Module which does not have any Exception defined.Inside that Function Module there is a FORM which raises an exception. How can I catch that exception?
‎2006 Aug 10 10:38 AM
you should define that as EXCEPTION in EXCEPTIONS TAB of that function module.else it cant catch them.
regards
srikanth
‎2006 Aug 10 10:38 AM
hi Anuritha,
But Before that make sure that you define that exception in exception Tab...
Check this one
call function 'ITS_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = tempfile
filetype = typ
mode = mode
wk1_t_format = wk1_t_format
wk1_n_format = wk1_n_format
IMPORTING
filelength = filelength
TABLES
data_tab = data_tab
EXCEPTIONS
file_write_error = 1
gui_refuse_filetransfer = 2
others = 3.
if sy-subrc = 1.
raise file_write_error.
elseif sy-subrc = 2.
raise unknown_error.
elseif sy-subrc = 3.
raise unknown_error.
endif.
exit.
endif.
‎2006 Aug 10 10:49 AM
It is a standard function mdule and EXCEPTIONS parameter is not defined...
‎2006 Aug 10 11:18 AM
What function module are you using?
How can a subroutine within a function raise an exception if the exception is not registered with the function?
Is the subroutine raising an exception or does it issue an error/abend message?
-Kiran
‎2006 Aug 10 10:42 AM
Hi,
If any error occurs and is stored in the system messages, then they wud be stored in sy-msgid, sy-msgno, and msgv1, msgv2, msgv3,msgv4.
Use the FM: MESSAGE_TEXT_BUILD to display the error message.
Regards
Subbu
‎2006 Aug 10 10:44 AM
Hi Anuritha,
Use <b>TRY..CATCH..ENDTRY.</b> to catch EXCEPTIONS .But before this you should know the name of the EXCEPTION.
Try this PSEUDO Code.
TRY
CALL FUNCTION'TEST'.
CATCH <Exception Name> into variable.
write variable.
ENDTRY.
And also Check this <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm">Help</a>
Regards,
Raghav