<?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: Loop through header and item internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577633#M589169</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Babu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can do something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop it_header.
*Call bapi to create header
  loop it_item where field_key = it_header-field_key.
*  Call bapi to create item   
  endloop.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important part is the where sentence in the second loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;      David N.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2007 16:49:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-07T16:49:18Z</dc:date>
    <item>
      <title>Loop through header and item internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577630#M589166</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;    My scenario will be like this, i have two internal tables which is populated based on certain conditions, now i have to call one bapi to update values that am going to store values in a tree structure say for eg mat01 is header and mat02 and mat03 are item values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      What is the efficient method to call that bapi one time for header creation and consequte times for item creation respectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  shall i have to loop thro two internal tables i.e header and item?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suggestions are welcomed from the experts...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Babu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 16:37:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577630#M589166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T16:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through header and item internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577631#M589167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u need to loop first through header item and internally loop through the item level data which would be a efficient way of posting data into SAP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 16:42:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577631#M589167</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T16:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through header and item internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577632#M589168</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;&lt;/P&gt;&lt;P&gt; Ensure that you have some relation between header and item..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_vbap by vbeln.&lt;/P&gt;&lt;P&gt;loop at it_vbap.&lt;/P&gt;&lt;P&gt;at new vbeln.&lt;/P&gt;&lt;P&gt;read table it_vbak with key vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of vbeln.&lt;/P&gt;&lt;P&gt;call bapi..&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;mahesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 16:46:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577632#M589168</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T16:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through header and item internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577633#M589169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Babu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can do something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop it_header.
*Call bapi to create header
  loop it_item where field_key = it_header-field_key.
*  Call bapi to create item   
  endloop.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important part is the where sentence in the second loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;      David N.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 16:49:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-header-and-item-internal-table/m-p/2577633#M589169</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T16:49:18Z</dc:date>
    </item>
  </channel>
</rss>

