<?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 query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307514#M504985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;With in a loop ..endloop use any number of READ's of internal table&lt;/P&gt;&lt;P&gt;but Selects are not recommended.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so use for all entries of ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not ITAB[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select single from tab1 into table JTAB  ofr all entries in itab where f1 = itab-f1...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select f1 f2 f3  into table Ktab for all entries in Itab where f1 =  itab-f1....&lt;/P&gt;&lt;P&gt; select f1 f2 f3  into table Mtab for all entries in Itab where f1 =  itab-f1....&lt;/P&gt;&lt;P&gt;................................................&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at ITAB.&lt;/P&gt;&lt;P&gt; read table Jtab with key...&lt;/P&gt;&lt;P&gt; read table ktab with key...&lt;/P&gt;&lt;P&gt; read table mtab with key...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &amp;lt; modify the Itab or move the fields to another int table and append it &amp;gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2007 10:26:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-23T10:26:48Z</dc:date>
    <item>
      <title>select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307512#M504983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;How to write a efficient select query for the following scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I have data in ITAB.&lt;/P&gt;&lt;P&gt;2.based on data ( say MATNR) in itab i have to write a query to select single field (say  product group ) into another table JTAB by comparing MATNR for all materials in ITAB..&lt;/P&gt;&lt;P&gt;3.Based on ITAB data only(in Loop at ITAB) i want to read another table KTAB by comparing key fields.If sy-subrc = 0.then i want to read some data into LTAB.&lt;/P&gt;&lt;P&gt;4. Based on LTAB data i want to write another query into MTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it good idea to write in single loop ITAB?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:18:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307512#M504983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307513#M504984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yes, u can write the code in a single LOOP Statement.&lt;/P&gt;&lt;P&gt;Each time while reading other internal tables data based on key fields always use READ statement and then proceed further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Himanshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:22:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307513#M504984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307514#M504985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;With in a loop ..endloop use any number of READ's of internal table&lt;/P&gt;&lt;P&gt;but Selects are not recommended.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so use for all entries of ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not ITAB[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select single from tab1 into table JTAB  ofr all entries in itab where f1 = itab-f1...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select f1 f2 f3  into table Ktab for all entries in Itab where f1 =  itab-f1....&lt;/P&gt;&lt;P&gt; select f1 f2 f3  into table Mtab for all entries in Itab where f1 =  itab-f1....&lt;/P&gt;&lt;P&gt;................................................&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at ITAB.&lt;/P&gt;&lt;P&gt; read table Jtab with key...&lt;/P&gt;&lt;P&gt; read table ktab with key...&lt;/P&gt;&lt;P&gt; read table mtab with key...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &amp;lt; modify the Itab or move the fields to another int table and append it &amp;gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:26:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307514#M504985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307515#M504986</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 required then only use LOOP and ENDLOOP statement, otherwise use READ TABLE statement. for example just want to check the entries in an internal table then in this scenario u can use read table other wise if you want to pass some values for all existing records then use loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:26:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307515#M504986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307516#M504987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;you can write single loop.&lt;/P&gt;&lt;P&gt;2. select f1  from mara into jtab for all entries in itab where matnr = itab-matnr.&lt;/P&gt;&lt;P&gt;use like this&lt;/P&gt;&lt;P&gt;3.sort : itab,ktab.&lt;/P&gt;&lt;P&gt;sort based on key field.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;read table ktab with key f1 = itab-f1.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;populate ktab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;4.write another select statement.&lt;/P&gt;&lt;P&gt;select f1 from table into mtab for all entries in latab where field = itab-field&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:32:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307516#M504987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307517#M504988</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;write it like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single product &lt;/P&gt;&lt;P&gt;          from jtab&lt;/P&gt;&lt;P&gt;          for all entries in itab&lt;/P&gt;&lt;P&gt;          where matnr eq itab-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by that key field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select data from KTAB based on key field&lt;/P&gt;&lt;P&gt;using for all entries in itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;similarly proceed for other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort the tables by their keys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table jtab with key matnr = itab-matnr binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;similarly read other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Asha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:37:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307517#M504988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307518#M504989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select * from  mara  into  corresponding fields  of  table&amp;lt;b&amp;gt;  itab&amp;lt;/b&amp;gt;   with where  &amp;lt;b&amp;gt;conditon of  select-option  like   where  matnr  in p_matnr  and  etc ....&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now data  in the &amp;lt;b&amp;gt; itab&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select  * from  makt  into  &amp;lt;b&amp;gt;  jtab&amp;lt;/b&amp;gt;    for all entries  in &amp;lt;b&amp;gt; itab&amp;lt;/b&amp;gt;  where   matnr  =   itab -matnr  and etc ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from  maka  into  &amp;lt;b&amp;gt;ktab&amp;lt;/b&amp;gt; for all entried  in   &amp;lt;b&amp;gt;itab&amp;lt;/b&amp;gt; where  matnr =  itab-matnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc   -= 0 .&lt;/P&gt;&lt;P&gt;select * from  makv   into   Ltab  for all entries   in   &amp;lt;b&amp;gt; ktab&amp;lt;/b&amp;gt;  where   matnr  =  ktab-matnr  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at Ltab  .&lt;/P&gt;&lt;P&gt;append  Ltab  to  &amp;lt;b&amp;gt;mtab&amp;lt;/b&amp;gt;  logic  .&lt;/P&gt;&lt;P&gt; endloop . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all the data will be fetched from the database   by single time  .... read  quesry is not required  for this  because   from the internal table  itself  you can  select the  dat from the database of the nextr table  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is use full  provide   points....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Girish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2007 10:42:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/2307518#M504989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-23T10:42:25Z</dc:date>
    </item>
  </channel>
</rss>

