<?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 CALLING SUBROUTINE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554747#M582148</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;  I wrote a program for subroutine. Now i want to call that subroutine. plz tell me how to call subroutine. plz tell me with one simple exam. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my first program to write subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZAC_TAB21.&lt;/P&gt;&lt;P&gt;PERFORM ADDNUM.&lt;/P&gt;&lt;P&gt;FORM ADDNUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NUM1 TYPE I VALUE 10,&lt;/P&gt;&lt;P&gt;NUM2 TYPE I VALUE 20,&lt;/P&gt;&lt;P&gt;RESULT TYPE I.&lt;/P&gt;&lt;P&gt;RESULT = NUM1 + NUM2.&lt;/P&gt;&lt;P&gt;WRITE:/ RESULT.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i want to call this subroutine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jul 2007 07:18:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-09T07:18:04Z</dc:date>
    <item>
      <title>CALLING SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554747#M582148</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;  I wrote a program for subroutine. Now i want to call that subroutine. plz tell me how to call subroutine. plz tell me with one simple exam. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my first program to write subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZAC_TAB21.&lt;/P&gt;&lt;P&gt;PERFORM ADDNUM.&lt;/P&gt;&lt;P&gt;FORM ADDNUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NUM1 TYPE I VALUE 10,&lt;/P&gt;&lt;P&gt;NUM2 TYPE I VALUE 20,&lt;/P&gt;&lt;P&gt;RESULT TYPE I.&lt;/P&gt;&lt;P&gt;RESULT = NUM1 + NUM2.&lt;/P&gt;&lt;P&gt;WRITE:/ RESULT.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i want to call this subroutine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 07:18:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554747#M582148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T07:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: CALLING SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554748#M582149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You have already written the Subroutine&lt;/P&gt;&lt;P&gt;make it a generic one like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM ADDNUM using v_no1 v_no2 .&lt;/P&gt;&lt;P&gt;FORM ADDNUM using p_no1 p_no2 .&lt;/P&gt;&lt;P&gt;DATA: RESULT TYPE I.&lt;/P&gt;&lt;P&gt;RESULT = p_no1  + p_no2.&lt;/P&gt;&lt;P&gt;WRITE:/ RESULT.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can use the statement differently and pass different variables&lt;/P&gt;&lt;P&gt;No need of writing the FORM...ENDFORM statement again.&lt;/P&gt;&lt;P&gt;So main use of subroutine is reusability.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM ADDNUM using v_no3  v_no4 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points for useful Answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 07:25:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554748#M582149</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T07:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: CALLING SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554749#M582150</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;You have called the subroutine ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM ADDNUM. "&amp;lt;&amp;lt;== This statement calls the subroutine ADDNUM, defined between FORM ADDNUM and ENDFORM....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement we use to call a subroutine is &amp;lt;b&amp;gt;PERFORM&amp;lt;/b&amp;gt; &amp;lt;formname&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do remember to close the thread, when ur problem is solved !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sai ramesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 07:27:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554749#M582150</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T07:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: CALLING SUBROUTINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554750#M582151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZAC_TAB21.

DATA:NUM1 TYPE I VALUE 10,
     NUM2 TYPE I VALUE 20.

PERFORM ADDNUM using NUM1  NUM2.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  ADDNUM
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_NUM1  text
*      --&amp;gt;P_NUM2  text
*----------------------------------------------------------------------*
FORM ADDNUM  USING    P_NUM1
                      P_NUM2.

DATA: RESULT TYPE I VALUE 20  .

RESULT = P_NUM1 + P_NUM2.
WRITE:/ RESULT.

ENDFORM.                    " ADDNUM&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the  above  program perform is the   call function for subrouine  ... while  execution of the program it come to the  perform  from ther it jumps to   FORM ADDNUM    and  execute the  lines in the Form ..... Endform   returns  to the perform statement   and ends the program ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;example  of  perform &amp;amp; form&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following five PERFORM statements mean the same but only the fourth is recommended, since it is the only one that documents the interface of the subroutine called. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: a1 TYPE string, 
      a2 TYPE string, 
      a3 TYPE string, 
      a4 TYPE string. 

PERFORM test USING a1 a2 a3 a4. 
PERFORM test CHANGING a1 a2 a3 a4. 
PERFORM test USING a1 CHANGING a2 a3 a4. 
PERFORM test USING a1 a2 CHANGING a3 a4. 
PERFORM test USING a1 a2 a3 CHANGING a4. 

... 

FORM test USING p1 TYPE string 
                p2 TYPE string 
          CHANGING value(p3) TYPE string 
                   value(p4) TYPE string. 
  ... 
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward  points if it is usefull ........&lt;/P&gt;&lt;P&gt;Girish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 07:36:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-subroutine/m-p/2554750#M582151</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T07:36:47Z</dc:date>
    </item>
  </channel>
</rss>

