<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: difference between using &amp; changing in perform subroutine in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539915#M577025</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI maya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Usually, using is used&lt;/P&gt;&lt;P&gt;   to pass parameters&lt;/P&gt;&lt;P&gt;   &amp;lt;b&amp;gt;which are not expected to change inside the routine&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Parameters, &amp;lt;b&amp;gt;which are expected to change inside the routine&amp;lt;/b&amp;gt;,&lt;/P&gt;&lt;P&gt;   are passed with the syntax of &amp;lt;b&amp;gt;CHANGING&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2007 12:37:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-12T12:37:41Z</dc:date>
    <item>
      <title>difference between using &amp; changing in perform subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539910#M577020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can any one explain me the exact difference between using &amp;amp; changing in perform subroutine with simple example..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 12:17:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539910#M577020</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T12:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: difference between using &amp; changing in perform subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539911#M577021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the below links..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_46c/helpdata/en/9f/db975c35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_46c/helpdata/en/9f/db975c35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_46c/helpdata/en/9f/db976935c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_46c/helpdata/en/9f/db976935c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 12:20:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539911#M577021</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2007-07-12T12:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: difference between using &amp; changing in perform subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539912#M577022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Subroutines are procedures that you can define in any ABAP program and also call from any program. Subroutines are normally called internally, that is, they contain sections of code or algorithms that are used frequently locally. If you want a function to be reusable throughout the system, use a function module. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A subroutine is a block of code introduced by FORM and concluded by ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM &amp;lt;subr&amp;gt; [USING ... [VALUE(]&amp;lt;pi&amp;gt;[)] [TYPE &amp;lt;t&amp;gt;|LIKE &amp;lt;f&amp;gt;]... ] &lt;/P&gt;&lt;P&gt;[CHANGING... [VALUE(]&amp;lt;pi&amp;gt;[)] [TYPE &amp;lt;t&amp;gt;|LIKE &amp;lt;f&amp;gt;]... ].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;subr&amp;gt; is the name of the subroutine. The optional additions USING and CHANGING define the parameter interface. Like any other processing block, subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program, especially for executable programs (type 1). In this way, you eliminate the risk of accidentally ending an event block in the wrong place by inserting a FORM...ENDFORM block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You call subroutines using the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM... [USING ... &amp;lt;pi&amp;gt;... ] &lt;/P&gt;&lt;P&gt;[CHANGING... &amp;lt;pi&amp;gt;... ].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutines can call other subroutines (nested calls) and may also call themselves (recursive calls). Once a subroutine has finished running, the calling program carries on processing after the PERFORM statement. You can use the USING and CHANGING additions to supply values to the parameter interface of the subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM ADDITION USING 1 2.&lt;/P&gt;&lt;P&gt;PERFORM ADDITION USING 3 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM ADDITION USING V1 V2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: V3 TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;V3 = V1 + V2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE:/ V1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 12:23:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539912#M577022</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T12:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: difference between using &amp; changing in perform subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539913#M577023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no difference when you PASS BY REFERENCE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The difference is only when you PASS BY VALUE as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass by value for USING parameters &lt;/P&gt;&lt;P&gt;For each formal parameter p1 p2 ..., a local object with the same data type as the corresponding actual parameter is created in the subroutine and filled with its values. A change to the formal parameter in the subroutine does not change the value of the actual parameter. The actual parameter also retains its original value even after the subroutine has ended. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass by value for CHANGING parameters &lt;/P&gt;&lt;P&gt;For each formal parameter p1 p2 ..., a local data object with the same data type as the corresponding actual parameter is created in the subroutine and filled with its values. A change to the formal parameter in the subroutine does not directly change the value of the actual parameter. If the subroutine is ended using ENDFORM, RETURN, CHECK or EXIT however, the content of the formal parameter is assigned to the actual parameter. If the subroutine is ended by a message or an exception, the actual parameter remains unchanged.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 12:23:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539913#M577023</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-07-12T12:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: difference between using &amp; changing in perform subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539914#M577024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi maya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk out this example...&lt;/P&gt;&lt;P&gt;DATA: num1 TYPE i,&lt;/P&gt;&lt;P&gt;      num2 TYPE i,&lt;/P&gt;&lt;P&gt;      sum  TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;num1 = 2. num2 = 4.&lt;/P&gt;&lt;P&gt;PERFORM addit USING num1 num2 CHANGING sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;num1 = 7. num2 = 11.&lt;/P&gt;&lt;P&gt;PERFORM addit USING num1 num2 CHANGING sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM addit&lt;/P&gt;&lt;P&gt;       USING add_num1   TYPE any&lt;/P&gt;&lt;P&gt;             add_num2   TYPE any&lt;/P&gt;&lt;P&gt;       CHANGING add_sum TYPE any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  add_sum = add_num1 + add_num2.&lt;/P&gt;&lt;P&gt;  PERFORM out USING add_num1 add_num2 add_sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM out&lt;/P&gt;&lt;P&gt;       USING out_num1 TYPE any&lt;/P&gt;&lt;P&gt;             out_num2 TYPE any&lt;/P&gt;&lt;P&gt;             out_sum  TYPE any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE: / 'Sum of', out_num1, 'and', out_num2, 'is', out_sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;jaideep&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*if useful reward points..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 12:37:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539914#M577024</guid>
      <dc:creator>jaideeps</dc:creator>
      <dc:date>2007-07-12T12:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: difference between using &amp; changing in perform subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539915#M577025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI maya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Usually, using is used&lt;/P&gt;&lt;P&gt;   to pass parameters&lt;/P&gt;&lt;P&gt;   &amp;lt;b&amp;gt;which are not expected to change inside the routine&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Parameters, &amp;lt;b&amp;gt;which are expected to change inside the routine&amp;lt;/b&amp;gt;,&lt;/P&gt;&lt;P&gt;   are passed with the syntax of &amp;lt;b&amp;gt;CHANGING&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 12:37:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539915#M577025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T12:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: difference between using &amp; changing in perform subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539916#M577026</link>
      <description>&lt;P&gt;REPORT ZRK_PGM2_SUB_ROUTINES.
DATA: AVAR1(100) TYPE C VALUE 'SHELL'.
TYPES: BEGIN OF STRUCT_VBAP,
         VBELN LIKE VBAP-VBELN,
         POSNR LIKE VBAP-POSNR,
       END OF STRUCT_VBAP.
DATA: IT_VBAP1 TYPE STANDARD TABLE OF STRUCT_VBAP.
DATA: WA_VBAP TYPE STRUCT_VBAP.
PERFORM SUBROUTINE1 USING AVAR1 . "Pass By Reference USING(It is same as Pass By Reference CHANGING).
WRITE:/ 'Actual Parameter Value =', AVAR1.
ULINE.
PERFORM SUBROUTINE2 USING AVAR1 . "Pass By Reference CHANGING(It is same as Pass By Reference USING).
WRITE:/ 'Actual Parameter Value =', AVAR1.
ULINE.
PERFORM SUBROUTINE3 CHANGING AVAR1. "Pass By Value USING.
WRITE:/ 'Actual Parameter Value =', AVAR1.
ULINE.
PERFORM SUBROUTINE4 CHANGING AVAR1. "Pass By Value CHANGING(We can also use USING).
WRITE:/ 'Actual Parameter Value =', AVAR1.
PERFORM SUBROUTINE5 TABLES IT_VBAP1[]. "Passing Table Parameter
LOOP AT IT_VBAP1 INTO WA_VBAP.
  WRITE:/ WA_VBAP-VBELN, WA_VBAP-POSNR.
ENDLOOP.
*----------Pass By Reference USING----------*
FORM SUBROUTINE1 USING FVAR1.
  WRITE:/ 'Start of Pass By Reference USING'.
  WRITE:/ 'Formal Parameter Value =', FVAR1.
  FVAR1 = 'SHELL123'.
  WRITE:/ 'Changed Value =', FVAR1.
  WRITE:/ 'End of Pass By Reference USING'.
ENDFORM.
*-------------------------------------------------*
*-----------Pass By Reference CHANGING------------*
FORM SUBROUTINE2 CHANGING FVAR1.
  WRITE:/ 'Start of Pass By Reference CHANGING'.
  WRITE:/ 'Formal Parameter Value =', FVAR1.
  FVAR1 = 'SHELL123'.
  WRITE:/ 'Changed Value =', FVAR1.
  WRITE:/ 'End of Pass By Reference CHANGING'.
ENDFORM.
*-------------------------------------------------*
*-------------Pass By Value USING-----------------*
FORM SUBROUTINE3 USING VALUE(FVAR1).
  WRITE:/ 'Start of Pass By Value USING'.
  WRITE:/ 'Formal Parameter Value =', FVAR1.
  FVAR1 = 'SHELL123'.
  WRITE:/ 'Changed Value =', FVAR1.
  WRITE:/ 'End of Pass By Value USING'.
ENDFORM.
*--------------------------------------------------*
*-------------Pass By Value CHANGING---------------*
FORM SUBROUTINE4 CHANGING VALUE(FVAR1).
  WRITE:/ 'Start of Pass By Value CHANGING'.
  WRITE:/ 'Formal Parameter Value =', FVAR1.
  FVAR1 = 'SHELL123'.
  WRITE:/ 'Changed Value =', FVAR1.
  WRITE:/ 'End of Pass By Value CHANGING'.
ENDFORM.
*--------------------------------------------------*
*----------------Table Parameter-------------------*
FORM SUBROUTINE5 TABLES IT_VBAP2.
  SELECT VBELN POSNR
  FROM VBAP
  INTO TABLE IT_VBAP2.
ENDFORM.
*-------------------------------------------------*&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 22:49:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-using-changing-in-perform-subroutine/m-p/2539916#M577026</guid>
      <dc:creator>former_member273900</dc:creator>
      <dc:date>2020-03-11T22:49:19Z</dc:date>
    </item>
  </channel>
</rss>

