<?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 orders in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188931#M1980545</link>
    <description>&lt;P&gt;error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;with key client_id = ls_orders-client_id.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;correction:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;with key client_id = ls_client-client_id.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Apr 2020 15:53:51 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2020-04-14T15:53:51Z</dc:date>
    <item>
      <title>loop orders</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188930#M1980544</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
  &lt;P&gt;I loop over clients and I want to get the orders of that client every time :&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;loop at lt_client into ls_client.
  read table lt_orders
  into ls_orders
  with key client_id = ls_orders-client_id.
end loop.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;the problem is that I get the first order of the client every time.&lt;/P&gt;
  &lt;P&gt;Ex : I have client1 that has Order1, Order2 and Order3&lt;/P&gt;
  &lt;P&gt;I want to read into ls_orders :&lt;/P&gt;
  &lt;P&gt;- Order1 in the first loop&lt;/P&gt;
  &lt;P&gt;- Order2&lt;/P&gt;
  &lt;P&gt;- and order 3&lt;/P&gt;
  &lt;P&gt;Any Ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 15:11:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188930#M1980544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-04-14T15:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: loop orders</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188931#M1980545</link>
      <description>&lt;P&gt;error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;with key client_id = ls_orders-client_id.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;correction:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;with key client_id = ls_client-client_id.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Apr 2020 15:53:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188931#M1980545</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-04-14T15:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: loop orders</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188932#M1980546</link>
      <description>&lt;P&gt;You need to do a nested loop. With your current logic, it would look like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT lt_client INTO ls_client.
  " do client/customer logic based on ls_client
  LOOP AT lt_orders INTO ls_orders WITH KEY client_id = ls_client-client_id.
    " do orders of customer logic based on ls_orders
  ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For performance reasons, if necessary, I would recommend an index on lt_orders by client. And also assign field-symbols instead of copying to new objects (unless you are messing around with values that shouldnt be updated in the table data):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: lt_client TYPE SORTED TABLE OF .... WITH UNIQUE KEY client_id.
FIELD-SYMBOLS: &amp;lt;fs_client&amp;gt; LIKE LINE OF lt_client,
               &amp;lt;fs_order&amp;gt;  LIKE LINE OF lt_orders.

LOOP AT lt_client ASSIGNING &amp;lt;fs_client&amp;gt;.
  " do client/customer logic based on &amp;lt;fs_client&amp;gt;
  LOOP AT lt_orders ASSIGNING &amp;lt;fs_order&amp;gt; WITH TABLE KEY client_id = &amp;lt;fs_client&amp;gt;-client_id.
    " do orders of customer logic based on &amp;lt;fs_order&amp;gt;
  ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Apr 2020 16:07:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188932#M1980546</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-04-14T16:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: loop orders</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188933#M1980547</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;khalilferhat&lt;/SPAN&gt;, please follow up on your open question.&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;comment answers or your question if there are still open issues.&lt;/LI&gt;&lt;LI&gt;otherwise mark an answer as accepted if it helped you solve your problem&lt;/LI&gt;&lt;LI&gt;or post an answer of yourself and accept it if you found another useful solution yourself&lt;/LI&gt;&lt;LI&gt;or redirect your question to another question that is related and was useful to solve your problem&lt;/LI&gt;&lt;LI&gt;in the end, close your question&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 13 May 2020 15:08:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-orders/m-p/12188933#M1980547</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-05-13T15:08:12Z</dc:date>
    </item>
  </channel>
</rss>

