<?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: SUBROUTINES in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151767#M992764</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All are modularization techniques but typically the INCLUDE is for data structures, the PERFORM is for ABAP/4 subroutines and function modules are for non-ABAP/4 subroutines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       By Value:When the subroutine is called ,the formal parameters are copies of the actual parameters(with their own storage location)&lt;/P&gt;&lt;P&gt;       By Value and Result : the formal parameters have a separate storage location .At the end of subroutine the value of the formal parameter is passed to the storage location of the actual parameter &lt;/P&gt;&lt;P&gt;Assigned&lt;/P&gt;&lt;P&gt;       By Reference: when called the formal parameters are not allocated separate storage locations. Instead the address of the actual parameter is passed. Changes to the values of the formal parameters therefore have a direct effect on the assigned main program fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM &amp;lt;name&amp;gt; USING &amp;lt;a1&amp;gt; &amp;lt;a2&amp;gt; &amp;lt;a3&amp;gt; &amp;lt;a4&amp;gt;&lt;/P&gt;&lt;P&gt;FORM &amp;lt;name &amp;gt; [TABLES &amp;lt;table name&amp;gt;] USING VALUE (&amp;lt;f1&amp;gt;) CHANGING VALUE (&amp;lt;f2&amp;gt;)&lt;/P&gt;&lt;P&gt;Include:&lt;/P&gt;&lt;P&gt;INCLUDE &amp;lt;name&amp;gt;&lt;/P&gt;&lt;P&gt;Function modules:&lt;/P&gt;&lt;P&gt; CALL FUNCTION u2018function nameu2019&lt;/P&gt;&lt;P&gt;             EXPORTING u2026&lt;/P&gt;&lt;P&gt;             IMPORTING u2026    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The EXCEPTIONS parameter is a section in the CALL FUNCTION statement where exceptional situations can be processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL FUNCTION u2018function nameu2019&lt;/P&gt;&lt;P&gt;                   EXPORTINGu2026&lt;/P&gt;&lt;P&gt;                   IMPORTINGu2026&lt;/P&gt;&lt;P&gt;        EXCEPTIONS NOT_FOUND = 3D1&lt;/P&gt;&lt;P&gt;                                  NOT_VALID = 3D2&lt;/P&gt;&lt;P&gt;                                  OTHERS = 3D3&lt;/P&gt;&lt;P&gt;       CASE SY-SUBRC&lt;/P&gt;&lt;P&gt;                                WHEN 1&lt;/P&gt;&lt;P&gt;                                 WHEN 2    &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;Rajasekhar Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Jul 2008 09:14:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-11T09:14:11Z</dc:date>
    <item>
      <title>SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151763#M992760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hii,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone give me the complete information about subroutines. How, PERFORM (Using and changing), FORM are used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:10:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151763#M992760</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151764#M992761</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;Pls Go through the following link,you will get Deatil description on subrouitne&lt;/P&gt;&lt;P&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/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_nw70/helpdata/en/9f/db982c35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/9f/db982c35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SAMPLE Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-on-subroutines.html" target="test_blank"&gt;http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-on-subroutines.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sujit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:11:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151764#M992761</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151765#M992762</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;check out these links.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/9f/db982c35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/9f/db982c35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap.ittoolbox.com/documents/popular-q-and-a/macro-vs-subroutine-1594#" target="test_blank"&gt;http://sap.ittoolbox.com/documents/popular-q-and-a/macro-vs-subroutine-1594#&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Sumit Agarwal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:11:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151765#M992762</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151766#M992763</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;Check the following link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[http://help.sap.com/saphelp_46c/helpdata/en/9f/db976935c111d1829f0000e829fbfe/content.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Anirban Bhattacharjee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:12:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151766#M992763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151767#M992764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All are modularization techniques but typically the INCLUDE is for data structures, the PERFORM is for ABAP/4 subroutines and function modules are for non-ABAP/4 subroutines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       By Value:When the subroutine is called ,the formal parameters are copies of the actual parameters(with their own storage location)&lt;/P&gt;&lt;P&gt;       By Value and Result : the formal parameters have a separate storage location .At the end of subroutine the value of the formal parameter is passed to the storage location of the actual parameter &lt;/P&gt;&lt;P&gt;Assigned&lt;/P&gt;&lt;P&gt;       By Reference: when called the formal parameters are not allocated separate storage locations. Instead the address of the actual parameter is passed. Changes to the values of the formal parameters therefore have a direct effect on the assigned main program fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM &amp;lt;name&amp;gt; USING &amp;lt;a1&amp;gt; &amp;lt;a2&amp;gt; &amp;lt;a3&amp;gt; &amp;lt;a4&amp;gt;&lt;/P&gt;&lt;P&gt;FORM &amp;lt;name &amp;gt; [TABLES &amp;lt;table name&amp;gt;] USING VALUE (&amp;lt;f1&amp;gt;) CHANGING VALUE (&amp;lt;f2&amp;gt;)&lt;/P&gt;&lt;P&gt;Include:&lt;/P&gt;&lt;P&gt;INCLUDE &amp;lt;name&amp;gt;&lt;/P&gt;&lt;P&gt;Function modules:&lt;/P&gt;&lt;P&gt; CALL FUNCTION u2018function nameu2019&lt;/P&gt;&lt;P&gt;             EXPORTING u2026&lt;/P&gt;&lt;P&gt;             IMPORTING u2026    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The EXCEPTIONS parameter is a section in the CALL FUNCTION statement where exceptional situations can be processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL FUNCTION u2018function nameu2019&lt;/P&gt;&lt;P&gt;                   EXPORTINGu2026&lt;/P&gt;&lt;P&gt;                   IMPORTINGu2026&lt;/P&gt;&lt;P&gt;        EXCEPTIONS NOT_FOUND = 3D1&lt;/P&gt;&lt;P&gt;                                  NOT_VALID = 3D2&lt;/P&gt;&lt;P&gt;                                  OTHERS = 3D3&lt;/P&gt;&lt;P&gt;       CASE SY-SUBRC&lt;/P&gt;&lt;P&gt;                                WHEN 1&lt;/P&gt;&lt;P&gt;                                 WHEN 2    &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;Rajasekhar Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:14:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151767#M992764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151768#M992765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAP Help for performs in:&lt;/P&gt;&lt;P&gt;[ABAP|http://help.sap.com/saphelp_nwpi71/helpdata/en/9f/db976935c111d1829f0000e829fbfe/frameset.htm]&lt;/P&gt;&lt;P&gt;[Sapscript|http://help.sap.com/saphelp_nwpi71/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:19:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151768#M992765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151769#M992766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In abap, there is a concept of modularization to increase the reusability of the code/function.So along with subroutines,i would suggest you to even have a little idea of all these techniques.Just check these links in the sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Modularization&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now u can go through :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/9f/db974f35c111d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/9f/db974f35c111d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the  topis,i.e, Function modules &amp;amp; subroutines&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;Bhumika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:19:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151769#M992766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINES</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151770#M992767</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; Yeah.Generally To avoid code redundancy we go for Subroutines. To complete a single complete process subroutines can be used. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;an example will make u understand better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: itab TYPE STANDARD TABLE OF vbak,
      field1 TYPE vbak-vbeln,
      field2 TYPE vbap-posnr.



PERFORM get_data TABLES itab
                 USING field1
                 CHANGING field2


                .

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_data
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;IT_TAB1    text
*      --&amp;gt;IV_FIELD1  text
*      --&amp;gt;OV_FIELD2  text
*----------------------------------------------------------------------*
FORM get_data TABLES it_tab1
              USING iv_field1
              CHANGING ov_field2


              .

ENDFORM.                    "get_data

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here note that the *&lt;STRONG&gt;order of TABLES, USING, CHANGING&lt;/STRONG&gt; should not be changed as USING, TABLES, CHANGING which will not work* &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the values you pass throuhg USING cannot be changed inside the subroutine ( so its READ ONLY )&lt;/P&gt;&lt;P&gt;the tables should be passed in TABLES which can be changed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Kothand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2008 09:23:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutines/m-p/4151770#M992767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-11T09:23:42Z</dc:date>
    </item>
  </channel>
</rss>

