‎2010 Jan 01 6:00 AM
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
‎2010 Jan 01 6:11 AM
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.
‎2010 Jan 01 6:15 AM
guess there are no Exceptions defined here.
so u can go with the condition return table is initial or not.
‎2010 Jan 01 6:55 AM
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...
‎2010 Jan 01 7:18 AM
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.
‎2010 Feb 01 7:02 PM
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.