‎2006 Aug 23 5:31 AM
Hi Frnds,
I have a requirement in which i run a report in Background. I have used some Function modules in that, i need to capture the exception and display the error message in the Spool.
Kindly let me know the procedure to do this.
Regards
Sowmmya B
‎2006 Aug 23 5:36 AM
Hi,
Inorder to display the message in spool, you have to only type a WRITE statement. eg.
CALL FUNCTION 'Z_DEMO`
EXPORTING
mandt = sy-mandt
EXCEPTIONS
NO_ROW = 1
ACCESS = 2.
<b> IF Sy-subrc eq 1.
WRITE :/`ERROR : No row selected`.
endif.</b>
Here i am assuming that you want to capture Exception no. 1. If you want to capture any other exception, then just mention the value of the corresponding exception.
Best regards,
Prashant
‎2006 Aug 23 5:41 AM
Hi,
As per my understanding, for reports that are executed in background the spool request is created for the report output.
So if there is a case where you want to capture some error from Function and display on the spool, what you should do is:
1. After calling the Function Module, check if there is a exception
2. If exception has occured write the exception output using WRITE statement, instead of giving I/E messages.
3. As this exception info is diplayed in the report output, the same will also be availble in the spool request.
Thanks !!
Regards,
Vishal
Award if helpful
Regards,
Vishal
‎2006 Aug 23 6:06 AM
Hi,
I tried as per your instructions, still i coudnt get the message in the spool ..
Pls suggest me some other way to do this.
Regards
Sowmmya B
‎2006 Aug 23 6:21 AM
HI
Example given by Prasanth should work. As it is not
working, can you post your code which can help friends
here and advice.
Kind Regards
Eswar