<?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: looping the internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900336#M935935</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this code:&lt;/P&gt;&lt;P&gt;Retriev matnr also then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_itab1 like line of itab1&lt;/P&gt;&lt;P&gt;similarly declare other work areas&lt;/P&gt;&lt;P&gt;Loop at itab1 into wa_itab1.&lt;/P&gt;&lt;P&gt;read table l_t_mara into wa_mara with key matnr = wa_itab1-matnr.&lt;/P&gt;&lt;P&gt;wa_itab-voleh = wa_mara-voleh&lt;/P&gt;&lt;P&gt;wa_itab-volum =&lt;/P&gt;&lt;P&gt;wa_itab-mtart =&lt;/P&gt;&lt;P&gt;read table l_t_zcnmm_volume into wa_t_zcnmm_volume with key matnr = wa_itab1-matnr.&lt;/P&gt;&lt;P&gt;wa_itab-zlegt  = wa_t_zcnmm_volume-zlegt&lt;/P&gt;&lt;P&gt;wa_itab-zwdth =&lt;/P&gt;&lt;P&gt;wa_itab-zhgth =&lt;/P&gt;&lt;P&gt;wa_itab-zvolm =&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append wa_itab to lt_itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mukul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Mukul Sharma on Jun 4, 2008 3:37 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jun 2008 13:36:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-04T13:36:35Z</dc:date>
    <item>
      <title>looping the internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900332#M935931</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 have two select queries like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select  voleh volum mtart&lt;/P&gt;&lt;P&gt;      into table l_t_mara&lt;/P&gt;&lt;P&gt;      from mara&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN itab1&lt;/P&gt;&lt;P&gt;      where matnr = itab1-matnr and&lt;/P&gt;&lt;P&gt;            mtart in mtart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select  zlegt zwdth zhgth zvolm&lt;/P&gt;&lt;P&gt;      into table l_t_zcnmm_volume&lt;/P&gt;&lt;P&gt;      from zcnmm_volume&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN itab1&lt;/P&gt;&lt;P&gt;      where matnr = itab1-matnr and&lt;/P&gt;&lt;P&gt;            werks = itab1-werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to move the fields voleh volum mtart zlegt zwdth zhgth zvolm into global internal table itab which is having same structure as itab1.How can I do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 13:19:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900332#M935931</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T13:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: looping the internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900333#M935932</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;fetch MATNR also ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then loop throgh one internal table,&lt;/P&gt;&lt;P&gt;inside loop read second internal table&lt;/P&gt;&lt;P&gt;then pass all the values for that particular MATNR into main ITab work area,&lt;/P&gt;&lt;P&gt;then append it to main internal table.&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;muralidhar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 13:29:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900333#M935932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T13:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: looping the internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900334#M935933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the first query directly append the entries in your global internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now since Matnr is the common field in both the tables.You can modify the already filled global internal table based on the values of matnr transporting the fileds from your second query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_global is your global table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move fields from l_t_mara to t_global.&lt;/P&gt;&lt;P&gt;append t_lobal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for second query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at l_t_zcnmm_volume.&lt;/P&gt;&lt;P&gt;modify t_global from l_t_zcnmm_volume where matnr = l_t_zcnmm_volume-matnr trasnporting required fileds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append t_global.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chek the syntax.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 13:31:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900334#M935933</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T13:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: looping the internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900335#M935934</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;Can you please give me an example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 13:31:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900335#M935934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T13:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: looping the internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900336#M935935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this code:&lt;/P&gt;&lt;P&gt;Retriev matnr also then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_itab1 like line of itab1&lt;/P&gt;&lt;P&gt;similarly declare other work areas&lt;/P&gt;&lt;P&gt;Loop at itab1 into wa_itab1.&lt;/P&gt;&lt;P&gt;read table l_t_mara into wa_mara with key matnr = wa_itab1-matnr.&lt;/P&gt;&lt;P&gt;wa_itab-voleh = wa_mara-voleh&lt;/P&gt;&lt;P&gt;wa_itab-volum =&lt;/P&gt;&lt;P&gt;wa_itab-mtart =&lt;/P&gt;&lt;P&gt;read table l_t_zcnmm_volume into wa_t_zcnmm_volume with key matnr = wa_itab1-matnr.&lt;/P&gt;&lt;P&gt;wa_itab-zlegt  = wa_t_zcnmm_volume-zlegt&lt;/P&gt;&lt;P&gt;wa_itab-zwdth =&lt;/P&gt;&lt;P&gt;wa_itab-zhgth =&lt;/P&gt;&lt;P&gt;wa_itab-zvolm =&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append wa_itab to lt_itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mukul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Mukul Sharma on Jun 4, 2008 3:37 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 13:36:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900336#M935935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T13:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: looping the internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900337#M935936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If the relationship bet'n mara and zcnmm_volume is 1 to many, which i think is, then you can use a inner join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select m~voleh m~volum m~mtart
z~zlegt z~zwdth z~zhgth z~zvolm
into table itab 
from mara as m inner join 
zcnmm_volume as z on
m~matnr = z~matnr
and m~werks = z~werks
FOR ALL ENTRIES IN itab1
where matnr = itab1-matnr and
mtart in mtart.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now itab will have all the fields from both the tables mara as well as the z table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note inner join is fast compared to nested loops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 13:46:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-the-internal-table/m-p/3900337#M935936</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T13:46:50Z</dc:date>
    </item>
  </channel>
</rss>

