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

Subroutines Using and Changing Parameters-No syntax error

kiran_k8
Active Contributor
0 Likes
901
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.

3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
799

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.

Read only

matt
Active Contributor
799

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

Read only

retired_member
Product and Topic Expert
Product and Topic Expert