09-22-2008 3:04 AM
Hi All ,
I Am getting this error in an upgrade environment testing
Passing the formal parameter "SUBRC" to the field SY-SUBRC is not appropriate .
since SY-SUBRC is set by the statement,
This is while calling FM 'HR_READ_INFOTYPE'.
Thanks in advance for any input on the reason for error .
Vinay
09-22-2008 3:12 AM
Reason is clearly mentioned.
you can't change sy-subrc on your own.
09-22-2008 4:20 AM
Hello Vinay
You try to fetch the value of EXPORTING parameter SUBRC into sy-subrc which is not correct because the sy-subrc will be set by the fm (either = 0 or in case of an exception = 1).
Not correct:
data: gt_pa0001 type STANDARD TABLE OF pa0001.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = '12345678'
infty = '0001'
* BEGDA = '18000101'
* ENDDA = '99991231'
* BYPASS_BUFFER = ' '
* LEGACY_MODE = ' '
IMPORTING
SUBRC = sy-subrc
tables
infty_tab = gt_pa0001
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Correct:
data: gt_pa0001 type STANDARD TABLE OF pa0001,
gd_rc type syst-subrc.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = '12345678'
infty = '0001'
* BEGDA = '18000101'
* ENDDA = '99991231'
* BYPASS_BUFFER = ' '
* LEGACY_MODE = ' '
IMPORTING
SUBRC = gd_rc
tables
infty_tab = gt_pa0001
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Uwe