Skip to Content
-2

Subroutines Using and Changing Parameters-No syntax error

Feb 23 at 06:28 AM

54

avatar image
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.

10 |10000 characters needed characters left characters exceeded

Don't use FORMs - they're obsolete language elements. For exactly reasons like the behaviour you're seeing!

2
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sandra Rossi Feb 23 at 07:02 AM
2

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.

Share
10 |10000 characters needed characters left characters exceeded
Horst Keller
Feb 23 at 10:43 AM
0
Share
10 |10000 characters needed characters left characters exceeded