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

How to show error message in a report program

Former Member
0 Likes
4,181

Hello Guys,

I am making a report using smartforms. I am successful in showing data but problem is if if i put a value in parameters that does not exist is database, the smartform runs and related fields shows as empty fields. But the form is running. I want to show error message if the parameter values dose not matches with the database values. The message will show as Document not exists

So i used related error msg here like

 if sy-subrc ne 0.
          message e357.
           endif.

But it is not working for passing values to smartform. It works if i use in classical report. Plz help me on this issue.

Thanks,

Rosaline.

Hello Guys,

I am making a report using smartforms. I am successful in showing data but problem is if if i put a value in parameters that does not exist is database, the smartform runs and related fields shows as empty fields. But the form is running. I want to show error message if the parameter values dose not matches with the database values. The message will show as Document not exists

So i used related error msg here like

 if sy-subrc ne 0.
          message e357.
           endif.

But it is not working for passing values to smartform. It works if i use in classical report. Plz help me on this issue.

Thanks,

Rosaline.

10 REPLIES 10
Read only

Former Member
0 Likes
1,881

Dear Rosaline,

Before calling the smartform, check whether the data that you are passing to smartform is initial or not.

So the approach can be:

1. Read the data from the database tables based on the entries made by the user on the selection screen.

2. Prepare the data to be printed / displayed

3. Check if there is any data to be displayed / printed. If there is not data, display the message 'No records found' else display it in an ALV grid or call the smartform for the printout (as per your requirement).

Hope it answers your query.

Cheers!!!

Amit

Read only

Former Member
0 Likes
1,881

Hi,

Hope you are giving this error message in the Report.

You must assign the Error Message number to a Message class.

Example.

Message e000(8i) with 'Parameter value not found'.

Here 000 is the message number in the message class 8i.

Then please check the whether the internal table which you are passing to the smartform is not initial.

Please try with this.

With Regards,

Sumodh.P

Read only

0 Likes
1,881

Thanks all for reply. Should i have to use message before call function 'SSF_FUNCTION_MODULE_NAME' ? I tried it but not working.

if it_final[] is not initial.
            if sy-subrc ne 0.
           Message e000(8i) with 'Parameter value not found'.
           endif.
            endif.

Read only

0 Likes
1,881

Hi

You should check that you fields are not initial before calling the FM.

Thanks

Rahul Jain

Read only

0 Likes
1,881

>

> Thanks all for reply. Should i have to use message before call function 'SSF_FUNCTION_MODULE_NAME' ? I tried it but not working.

>

>

if it_final[] is not initial.
>*             if sy-subrc ne 0. ---> "Remove this condition check, it not required
>            Message e000(8i) with 'Parameter value not found'.
>            endif.
> *            endif. ---> "remove this
> 

Hi,

Sy-subrc doesnt need to be validated here, remove that If condition and check again.

Regards,

Karthik D

Read only

Former Member
0 Likes
1,881

hi,

write like this...

if sy-subrc ne 0.

message e357.

exit.

endif.

Regards

Ganesh Reddy

Read only

Former Member
0 Likes
1,881

hi,

try this

if sy-subrc <> 0.

message 'document not exsist' type 'S'

endif

Read only

Former Member
0 Likes
1,881

Hi,

Can you please tell me your program flow to call a smartform from driver program?In more specific I would like to know whether you have written the SQL query retrieve from the database and pass it to smartform as import parameter and or tables or you just call the smartforms in the driver program and did all the query parts in smartforms?

In case of first one means if you retrieve all the data which you need to show in smartforms in the driver program then before call SSF_FUNCTION_MODULE_NAME you check whether the Tables you are passing or the work area you are passing is initial or not.

In the second case first you check the data is there or not in the database by using selection screen values before storing in internal table.then do a sy-subrc check before the smartform calling.

Regards,

Suvajit.

Read only

Former Member
0 Likes
1,881

Hi,

write in this way.

IF ITAB IS NOT INITIAL.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'.

.........................................

.........................................

ELSE.

MESSAGE 'NO Parameter Found' TYPE 'S'.

LEAVE TO SCREEN 0.

ENDIF.

Regards,

Suvajit.

Read only

0 Likes
1,881

Thanks Suvajit. My problem is solved now.

With regards,

Tripod.