Skip to Content
-2

Subroutines Using and Changing Parameters-No syntax error

REPORT  ztest.
DATA:lv_bukrs TYPE bukrs,
     lv_werks TYPE werks,
     lv_spart TYPE spart,
     lv_vtweg TYPE vtweg.


PERFORM test1 USING lv_bukrs
                    lv_werks
           CHANGING lv_spart
                    lv_vtweg.
PERFORM test2 USING lv_bukrs
                    lv_werks
           CHANGING lv_spart
                    lv_vtweg.
*&---------------------------------------------------------------------*
*&      Form  test1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->LV_BUKRS   text
*      -->LV_WERKS   text
*      -->LV_SPART   text
*      -->LV_WTEG    text
*----------------------------------------------------------------------*
FORM test1 USING lv_bukrs
                lv_werks
       CHANGING lv_spart
                lv_vtwteg.
ENDFORM.                                                    "test1
*&---------------------------------------------------------------------*
*&      Form  test2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->LV_BUKRS   text
*      -->LV_WERKS   text
*      -->LV_SPART   text
*      -->LV_WTEG    text
*----------------------------------------------------------------------*
FORM test2 USING lv_bukrs
       CHANGING lv_werks
                lv_spart
                lv_vtwteg.
ENDFORM.                                                    "test2

For the 2nd subroutine FORM-ENDFORM, even though the USING and CHANGING parameters are not in synch,it is not throwing any error but showing syntactically correct and getting activated,where infact this should be an error.

Any thoughts on why is it so.

SAP ECC 6.0/SAP_ABA/701/0008/SAPKA70108.

Thanks,

K.Kiran.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Feb 23 at 07:02 AM

    It has always been like that. Only warnings in the syntax check if you change statically the values of USING parameters. SAP can't change the behavior because there's a lot of existing code which does that (even standard).

    https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapform.htm :

    • Formal parameters defined for pass by reference with USING should not be changed in the subroutine. In this case, CHANGING can be used instead. Changes produce syntax check warnings.

    Anyway, subroutines are obsolete.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 23 at 10:43 AM
    Add comment
    10|10000 characters needed characters exceeded