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

Code inspector error with exception

Former Member
0 Likes
3,630

I have below code :

 
 IF P_SUMM = C_ON.
   CALL FUNCTION 'ZSD_REPORT_HEADER'             "Write std Nike header
         EXPORTING
              PROGRAM   =  V_PROGRAM
              LINE_SIZE =  SY-LINSZ
              RUN_DATE  =  V_DATE
              RUN_TIME  =  V_TIME
              TITLE_1   =  TEXT-025
              TITLE_5   = '1424'
              PAGE_NO   =  SY-PAGNO.
   IF SY-SUBRC <> 0.
     WRITE: 'Problem with ZSI_REPORT_HEADER'(019).
   ENDIF.

However in the code inspector it is giving error :

Program ZSDR_TOP_ACC Include ZSDR_TOP_ACC Row 988 Column 0

No EXCEPTION to set SY_SUBRC Declared for CALL FUNCTION 'ZSI_REPORT_HEADER'

Thus the value of SY-SUBRC is always 0

Could you please suggest me how to eleminate error. YOUR Helpis highy appreciated.

Thanks in advance and happy new year.

Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:34 PM

5 REPLIES 5
Read only

Former Member
0 Likes
1,253

Hi Sam,

Happy new year.

This means that in your function module 'ZSD_REPORT_HEADER' exceptions are not defined.

You can check this in exception tab of 'ZSD_REPORT_HEADER' in SE37.

Hence , this FM will always return sy-subrc = 0 .

SO, instead of checking sy-subrc , check the return internal tables for initial.

Hope this helps you.

Read only

Former Member
0 Likes
1,253

guess there are no Exceptions defined here.

so u can go with the condition return table is initial or not.

Read only

Former Member
0 Likes
1,253

the reasons are already explained by the above users.

But see, i guess as per your coding standards you have added the sy-subrc check.. which is a good practice for standard function modules so as to check the correctness of the execution.. as i can see its a ZFM, you can better keep some exceptions to your FM and add the sy-subrc.

Or..

if you do not want to change the zfm, just remove the sy-subrc check...

Read only

former_member209217
Active Contributor
0 Likes
1,253

Hi Sam,

You have not added Exceptions to your function module.But you have included sy-subrc check after the function call.

Irrespective of whether your function module successfully executed or not sy-subrc will always be zero.Put some exceptions in your function module and then go for a sy-subrc check.

Regards,

Lakshman.

Read only

Former Member
0 Likes
1,253

CALL FUNCTION 'ZSI_REPORT_HEADER'

EXPORTING

PROGRAM = V_PROGRAM

LINE_SIZE = SY-LINSZ

RUN_DATE = V_DATE

RUN_TIME = V_TIME

TITLE_1 = TEXT-016

TITLE_5 = '1425'

PAGE_NO = SY-PAGNO

*ADD Exceptions even the FM does not have exceptions.

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC NE 0.

WRITE: 'Problem with ZSI_REPORT_HEADER'(028).

ENDIF.

We can add exception like above even though the exception was not declared in Function module.