<?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 query problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025350#M1348334</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 need to fetch multiple records from an interntal table using another internal table. ARC_PPDIX is an internal table that has multiple records for each selection of select_kostl-docnum and select_kostl-doclin. I am aware of 'FOR ALL ENTRIES'  syntax but it works only in case of DB tables. Now I am able to retrieve just one record for each query. How can I change this code to get the desired result?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT select_kostl.&lt;/P&gt;&lt;P&gt;    read TABLE ARC_PPDIX with key docnum = select_kostl-docnum&lt;/P&gt;&lt;P&gt;                             doclin = select_kostl-doclin binary search.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;   MOVE-CORRESPONDING ARC_PPDIX TO run_doc_xref.&lt;/P&gt;&lt;P&gt;   Append run_doc_xref.&lt;/P&gt;&lt;P&gt;   clear run_doc_xref.&lt;/P&gt;&lt;P&gt;  ENDIF.&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;VG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Aug 2009 15:57:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-07T15:57:14Z</dc:date>
    <item>
      <title>query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025350#M1348334</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 need to fetch multiple records from an interntal table using another internal table. ARC_PPDIX is an internal table that has multiple records for each selection of select_kostl-docnum and select_kostl-doclin. I am aware of 'FOR ALL ENTRIES'  syntax but it works only in case of DB tables. Now I am able to retrieve just one record for each query. How can I change this code to get the desired result?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT select_kostl.&lt;/P&gt;&lt;P&gt;    read TABLE ARC_PPDIX with key docnum = select_kostl-docnum&lt;/P&gt;&lt;P&gt;                             doclin = select_kostl-doclin binary search.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;   MOVE-CORRESPONDING ARC_PPDIX TO run_doc_xref.&lt;/P&gt;&lt;P&gt;   Append run_doc_xref.&lt;/P&gt;&lt;P&gt;   clear run_doc_xref.&lt;/P&gt;&lt;P&gt;  ENDIF.&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;VG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2009 15:57:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025350#M1348334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-07T15:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025351#M1348335</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 will have to use a loop inside another loop as you say there is many to many relation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT select_kostl.
loop at ARC_PPDIX where docnum = select_kostl-docnum and
doclin = select_kostl-doclin 
MOVE-CORRESPONDING ARC_PPDIX TO run_doc_xref.
Append run_doc_xref.
clear run_doc_xref.
endloop.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sachin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2009 16:03:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025351#M1348335</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-07T16:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025352#M1348336</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 u have to fetch multiple records based on another internal table, you cannot use READ statement since its fetches only one record per main loop. what you can do is write a nested loop and acheive it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT select_kostl.
LOOP AT ARC_PPDIX where docnum = select_kostl-docnum and doclin = select_kostl-doclin binary search.
MOVE-CORRESPONDING ARC_PPDIX TO run_doc_xref.
Append run_doc_xref.
clear run_doc_xref.
ENDLOOP.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2009 16:04:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025352#M1348336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-07T16:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025353#M1348337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try with loop inside loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT select_kostl.
LOOP AT ARC_PPDIX where  docnum = select_kostl-docnum
                                    and  doclin = select_kostl-doclin.
MOVE-CORRESPONDING ARC_PPDIX TO run_doc_xref.
Append run_doc_xref.
ENDLOOP.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2009 16:04:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025353#M1348337</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2009-08-07T16:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025354#M1348338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks. I was aware of using NESTED loops. I wanted to know is there a different way keeping the performance in view.  it seems nested loop is the uanimous choice. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2009 16:25:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-problem/m-p/6025354#M1348338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-07T16:25:10Z</dc:date>
    </item>
  </channel>
</rss>

