<?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: SUBROUTINE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886661#M371848</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to reuse the set(lines) of code.&lt;/P&gt;&lt;P&gt;easy to understand. no complexity.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Feb 2007 19:20:46 GMT</pubDate>
    <dc:creator>SantoshKallem</dc:creator>
    <dc:date>2007-02-01T19:20:46Z</dc:date>
    <item>
      <title>SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886656#M371843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WHATS THE USE OF SUBROUTINE IN THE PROGRAM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 19:11:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886656#M371843</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-01T19:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886657#M371844</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;Subroutine can be used code re-usablity..&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;P&gt;&lt;/P&gt;&lt;P&gt;Please reward points for helpful answers..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 19:14:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886657#M371844</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-01T19:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886658#M371845</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;Regards,&lt;/P&gt;&lt;P&gt;Vara&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 19:17:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886658#M371845</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-01T19:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886659#M371846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They are also used for modularizing the code, organnizing logic into smaller, more manageable coding blocks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 19:17:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886659#M371846</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-02-01T19:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886660#M371847</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 used to modularize your program struture for better readbility and function flow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the entire code is split into subroutines, its easy to debug for any newcomer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Subramanian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 19:18:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886660#M371847</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-01T19:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886661#M371848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to reuse the set(lines) of code.&lt;/P&gt;&lt;P&gt;easy to understand. no complexity.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 19:20:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886661#M371848</guid>
      <dc:creator>SantoshKallem</dc:creator>
      <dc:date>2007-02-01T19:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886662#M371849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darsh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You call a subroutine using the&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM subrc[(prog)] ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the (prog) addition, the call is internal. The subroutine is in the calling program and does not have to be loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use the (prog) addition, the call is external. The subroutine is in the program prog. When you call the subroutine, the entire program prog is loaded into the internal session of the calling program (if it has not been already). The loaded program belongs to the program group of the calling program. However, if the subroutine belongs to a function group, a new additional program group is created. The program group to which the external subroutine belongs determines the interface work areas and screens that it will use. However, this assignment can vary dynamically, so it is best to avoid using external subroutines.&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    p1 p2 ... ]&lt;/P&gt;&lt;P&gt;            [CHANGING p1 p2 ... ].&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;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 20:28:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886662#M371849</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2007-02-01T20:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886663#M371850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi darsh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Subroutines are modularization techniques. They make program easy to understand. We can keep a set of stmts which must be performed repeatedly as a set and call them using a single stmt wherever we require. This is the simple concept of the subroutines. This reduces the program size and also makes it easy to understand. For ex. in my program i have to select some data from a table, do some modifications to the data and then display it in the output. Then it can be done like this&lt;/P&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;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform fetch_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform modify_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform display_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form fetch_data.&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;form modify_data.&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;form display_data.&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;In the above program it can be easily understood that first the subroutine for fetching data is called. Then subroutine for modifying data is called. Then subroutine for displaying data is called. Here perform stmts are for calling the subroutines named after perform  and the actual action to be done i.e., the abap stmts for that particular task is given between form -- endform stmt. This block refers a subroutine body. similarly each form -- endform will refer to one subroutine body. Here the advantage is that it makes program easy to understand and also if we have to do same actions repeatedly like displaying data repeatedly after doing some modifications in the same manner, then we can simply call the subroutine with single stmt instead of writing the entire code repeatedly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope u understood.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are more options like using some parameters in the perform stmt like ' using ', etc. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function Modules are the advanced modularization techniques of subroutines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rajasekhar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 23:20:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886663#M371850</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-01T23:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886664#M371851</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;Procedure that can be defined in every ABAP program (except class pools and interface pools) but only outside classes. Can be called from any program. Begins with FORM and ends with ENDFORM.  Can be called thru PERFORM statment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is one of modularization techniques.  Quite often used piece of code can be written as a Subroutine and can be called anytime, anywhere depending upon where it is defined.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;U. Uma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2007 04:32:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/1886664#M371851</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-02T04:32:46Z</dc:date>
    </item>
  </channel>
</rss>

