<?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/3857949#M927304</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;Use like this.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM Y using lt_likp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form y using lt_likp type ty_t_likp.&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;&lt;/P&gt;&lt;P&gt;declare a table type globally as:&lt;/P&gt;&lt;P&gt;types : ty_t_likp type standard table of ty_likp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[where 'ty_likp' is the type of ' lt_likp'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 May 2008 12:25:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-12T12:25:01Z</dc:date>
    <item>
      <title>subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857942#M927297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at the moment im populating a table locally with in the subroutine...if i want to use the data in the internal table in anotha subroutine shud i have to make the table global or is there anyway to use the data in another subroutine so that i dont have to change the whole program..plz advise&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 11:25:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857942#M927297</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T11:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857943#M927298</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;If you are calling another subroutine within the subroutine in which u r populating data then you can simply pass that table to another one, no need to make it global&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;populating data in ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call sub2 tables ITAB.&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;Otherwise you nedd to define it globally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Aditya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 11:28:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857943#M927298</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T11:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857944#M927299</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;just declare the corresponding table globally and then use another subroutine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 11:29:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857944#M927299</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T11:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857945#M927300</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 can pass the table by call by reference or call by value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form &amp;lt;form_name&amp;gt; using &amp;lt;itab_name&amp;gt; type &amp;lt;table_type&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare a table type in the global declarations as.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if You have declared :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type standard table of ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then ====&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : ty_t_itab type standard table of ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form &amp;lt;form_name&amp;gt; using itab type ty_t_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...This is 'call by reference'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 11:35:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857945#M927300</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T11:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857946#M927301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;PERFORM get_batch_status USING p_matnr
                                 p_werks
                                 p_charg
                        CHANGING g_zustd.

FORM get_batch_status  USING    fp_p_matnr  TYPE mcha-matnr
                                fp_p_werks  TYPE mcha-werks
                                fp_p_charg  TYPE mcha-charg
                       CHANGING fp_g_zustd  TYPE mcha-zustd.
  
CLEAR fp_g_zustd.

  SELECT SINGLE zustd
  INTO    fp_g_zustd
  FROM          mch1
  WHERE         matnr    =    fp_p_matnr
  AND           charg    =    fp_p_charg.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same way u can use it for a internal table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 11:35:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857946#M927301</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T11:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857947#M927302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bright,&lt;/P&gt;&lt;P&gt;2 ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. If u r calling  another subroutine from current one then u can pass ur internal table in TABLES parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM form1.&lt;/P&gt;&lt;P&gt;do some thing to populate li_tab.&lt;/P&gt;&lt;P&gt;PERFORM form2 TABLES li_tab.&lt;/P&gt;&lt;P&gt;ENDFORM form1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM form2 TABLES p_tab.&lt;/P&gt;&lt;P&gt;Do some thing.&lt;/P&gt;&lt;P&gt;ENDFORM form2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note: If u are passing some internal table in TABLES&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;parmeter then it will be call by reference. SO if u change the&lt;/STRONG&gt; &lt;STRONG&gt;table content in form2 the same will be reflected after&lt;/STRONG&gt; &lt;STRONG&gt;PERFORM form2 in form1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second way is to declare ur itab as Global internal table. There is no need to change ur code by declaring itab as global. But this can be accessed and changed any where in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I feel first solution will be better option. Always avoid global declarations as much as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 11:36:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857947#M927302</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-05-12T11:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857948#M927303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi guyz...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your replyz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is how i declared &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM X .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Form X&lt;/P&gt;&lt;P&gt;declared lt_likp &lt;/P&gt;&lt;P&gt;*&lt;STRONG&gt;populate the internal table&lt;/STRONG&gt;*&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt;PERFORM Y tables lt_likp.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------" /&gt;&lt;P&gt;endform&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Form Y tables lt_likp...&lt;/P&gt;&lt;P&gt;_----&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error Message----&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;**lt_likp has no structure **&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz advise...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 12:00:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857948#M927303</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T12:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857949#M927304</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;Use like this.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM Y using lt_likp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form y using lt_likp type ty_t_likp.&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;&lt;/P&gt;&lt;P&gt;declare a table type globally as:&lt;/P&gt;&lt;P&gt;types : ty_t_likp type standard table of ty_likp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[where 'ty_likp' is the type of ' lt_likp'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 12:25:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857949#M927304</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T12:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857950#M927305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;      Just u use Import and Export parameters like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORT itab1 TO MEMORY ID 'ZCAT'. in one subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and next in other subroutine u decalare&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; IMPORT itab1 FROM MEMORY ID 'ZCAT'.&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;Lokesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 12:33:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine/m-p/3857950#M927305</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T12:33:12Z</dc:date>
    </item>
  </channel>
</rss>

