Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module Exception error as spool Request

Former Member
0 Likes
704

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

4 REPLIES 4
Read only

Former Member
0 Likes
580

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

Read only

Former Member
0 Likes
580

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

Read only

0 Likes
580

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

Read only

0 Likes
580
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