<?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: Select quiry issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528165#M1426239</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use FOR ALL ENTRIES with more than one table. You should be able to use a JOIN instead and get all your data with one SELECT, though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Jan 2010 18:51:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-01-12T18:51:49Z</dc:date>
    <item>
      <title>Select quiry issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528164#M1426238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. first select quirey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. for second select quiry i am using for all ntries of first select quiry internal table data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. now here in third select quiry in where condition i have to use first internal table data and second internal table data as well, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this third select quiry how to handle please suggest with code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: &lt;/P&gt;&lt;P&gt;         &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT ABKRS UABRJ UABRP FROM T569V INTO TABLE gt_t569v
                              FOR ALL ENTRIES IN gt_0001
                                WHERE ABKRS = gt_0001-abkrs.

          if gt_t569v is not initial.

            SELECT PERMO FROM T549A INTO TABLE GT_T549A
                                 FOR ALL ENTRIES IN gt_0001
                                WHERE ABKRS = GT_0001-ABKRS.

            IF NOT GT_T569v[] IS INITIAL.
              SELECT BEGDA FROM T549Q INTO TABLE gt_T549Q
                               FOR ALL ENTRIES IN GT_T569v
                                  WHERE PERMO = gt_T549A-PERMO AND
                                        PABRJ = gt_T569V-UABRJ AND
                                        PABRP = gt_T569V-UABRP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the third select quiry is showing error, Please correct it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Reddy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - Please use code tags around your code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Jan 12, 2010 1:48 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 18:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528164#M1426238</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-12T18:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Select quiry issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528165#M1426239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use FOR ALL ENTRIES with more than one table. You should be able to use a JOIN instead and get all your data with one SELECT, though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 18:51:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528165#M1426239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-12T18:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Select quiry issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528166#M1426240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please change the code as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

if gt_0001[] is not initial.

SELECT ABKRS 
              VWSAZ               " Fetch all key fields while using for all entries to get all data
              UABRJ 
              UABRP FROM T569V INTO TABLE gt_t569v
                              FOR ALL ENTRIES IN gt_0001
                                WHERE ABKRS = gt_0001-abkrs.


 SELECT ABKRS              " Fetch all key fields while using for all entries to get all data
               PERMO 
               FROM T549A INTO TABLE GT_T549A
                                 FOR ALL ENTRIES IN gt_0001
                                WHERE ABKRS = GT_0001-ABKRS.
 

 LOOP AT GT_T569V INTO WA_T569V.
      READ TABLE GT_T549A INTO WA_T549A WITH KEY ABKRS = WA_T569V-ABKRS BINARY SEARCH.

            IF SY-SUBRC  = 0.

               WA_FINAL-PERMO = WA_T549A-PERMO.
               WA_FINAL-UABRJ = WA_T569V-UABRJ.
               WA_FINAL-UABRP = WA_T569V-UABRP.
              APPEND WA_FINAL TO IT_FINAL.
               CLEAR WA_FINAL.

ENDLOOP.

IF IT_FINAL[] IS NOT INITIAL.

SELECT PERMO 
             PABRJ
             PABRP
             BEGDA FROM T549Q INTO TABLE gt_T549Q
                               FOR ALL ENTRIES IN GT_T569v
                                  WHERE PERMO = IT_FINAL-PERMO AND
                                        PABRJ = IT_FINAL-UABRJ AND
                                        PABRP = IT_FINAL-UABRP.
       
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need further info&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Satish Boguda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 19:16:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528166#M1426240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-12T19:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select quiry issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528167#M1426241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;You are checking the INITIAL condition for one internal table and using the command FOR ALL ENTRIES for a different internal table. It doesnu2019t make sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As suggested by ROB you can for a join between the tables and get the result in one go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else you may proceed like this:&lt;/P&gt;&lt;P&gt;1.Select data from your first table T0001 (I guess this is first table) into the internal table gt_0001.&lt;/P&gt;&lt;P&gt;2.Select required data from the table T569V into the internal table gt_569V for all entries in gt_0001.&lt;/P&gt;&lt;P&gt;3.Here looping and comparing the key fields in the 2 internal tables obtained above, prepare a third internal table, say gt_data.&lt;/P&gt;&lt;P&gt;4.Now select data from your third table T549Q for all entries in the internal table gt_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this might be tedious process. Also you may like 2 choose a join between the first 2 table and then go for a u201Cfor all entriesu201D for the selection from 3rd table. Both the procedures have pros and cons. You will need to take a call depending how much data you have in the 3 tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Pritam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 19:19:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-quiry-issue/m-p/6528167#M1426241</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-12T19:19:16Z</dc:date>
    </item>
  </channel>
</rss>

