<?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 doubt in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449217#M1413458</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;  instead of using the select statement inside the loop,try to use the  select statement using FOR ALL ENTRIES in ITAB1. &lt;/P&gt;&lt;P&gt;Data type of the fields in the where condition needs to be same as that of CDPOS table variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Dec 2009 05:53:25 GMT</pubDate>
    <dc:creator>nirajgadre</dc:creator>
    <dc:date>2009-12-21T05:53:25Z</dc:date>
    <item>
      <title>select query doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449212#M1413453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am writting this code .....first select is working fine for me as i am getting 5 entires in  table itab which i am expecting...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but for second when i loop itab itab then at that time i should get one record  in table itab2 out of second select query........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but as i can see while debugging  i am getting that entry at third time when i am in loop.....but it again i think it overwrites with next enter and making itab2 entry as 0 at the end.....&lt;/P&gt;&lt;P&gt;what might be problem.&lt;/P&gt;&lt;P&gt;even i write append itab2.&lt;/P&gt;&lt;P&gt;                    clear itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;same error i am getting...(here CDPOS is cluster table..is this because of this??)..pease help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen:begin of block test with frame title new.&lt;/P&gt;&lt;P&gt;select-options: s_ddate for vbak-vdatu.&lt;/P&gt;&lt;P&gt;selection-screen:end of block test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;vbeln a&lt;/SUB&gt;vdatu b&lt;SUB&gt;netpr b&lt;/SUB&gt;netwr b~matnr into corresponding fields of table itab&lt;/P&gt;&lt;P&gt;    from vbak as a inner join vbap as b on a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln where&lt;/P&gt;&lt;P&gt;       b~matnr = 'AUP-501'&lt;/P&gt;&lt;P&gt;    and a~vdatu in s_ddate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;select *  from CDPOS into table itab2 where&lt;/P&gt;&lt;P&gt;  OBJECTID = ITAB-VBELN AND&lt;/P&gt;&lt;P&gt;  TABNAME = 'VBAP' AND&lt;/P&gt;&lt;P&gt;  FNAME = 'NETPR'.&lt;/P&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 05:42:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449212#M1413453</guid>
      <dc:creator>former_member227140</dc:creator>
      <dc:date>2009-12-21T05:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: select query doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449213#M1413454</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 are completely into wrong performance..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as per your query&lt;/P&gt;&lt;P&gt;selection-screen:begin of block test with frame title new.&lt;/P&gt;&lt;P&gt;select-options: s_ddate for vbak-vdatu.&lt;/P&gt;&lt;P&gt;selection-screen:end of block test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;vbeln a&lt;/SUB&gt;vdatu b&lt;SUB&gt;netpr b&lt;/SUB&gt;netwr b~matnr into corresponding fields of table itab&lt;/P&gt;&lt;P&gt;from vbak as a inner join vbap as b on a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln where&lt;/P&gt;&lt;P&gt;b~matnr = 'AUP-501'&lt;/P&gt;&lt;P&gt;and a~vdatu in s_ddate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;select * from CDPOS into table itab2 where&lt;/P&gt;&lt;P&gt;OBJECTID = ITAB-VBELN AND&lt;/P&gt;&lt;P&gt;TABNAME = 'VBAP' AND&lt;/P&gt;&lt;P&gt;FNAME = 'NETPR'.&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;The second query is inside loop and its moving data into itab2 for every record in internnale table ITAB and&lt;/P&gt;&lt;P&gt;finally itab2 contains the last records of ITAB data if CDPOs has the data for itab-vbeln(last records).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To over come you need to write the select as beloew&lt;/P&gt;&lt;P&gt;select * from CDPOS APPENDING table itab2 where&lt;/P&gt;&lt;P&gt;OBJECTID = ITAB-VBELN AND&lt;/P&gt;&lt;P&gt;TABNAME = 'VBAP' AND&lt;/P&gt;&lt;P&gt;FNAME = 'NETPR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I suggest you to write for all entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &amp;lt;the filed you need&amp;gt; from CDPOS &lt;/P&gt;&lt;P&gt;into table itab2 &lt;/P&gt;&lt;P&gt;for all entries in itab&lt;/P&gt;&lt;P&gt;where OBJECTID = ITAB-VBELN AND&lt;/P&gt;&lt;P&gt;TABNAME = 'VBAP' AND FNAME = 'NETPR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then &lt;/P&gt;&lt;P&gt;loop at ITAB.&lt;/P&gt;&lt;P&gt;Read table itab2 with key vbeln = itab-vbeln binary search.&lt;/P&gt;&lt;P&gt;If sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&amp;lt;Write your code, functions etc&amp;gt;.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Nazeer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 05:49:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449213#M1413454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-21T05:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: select query doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449214#M1413455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT ITAB.
select * from CDPOS APPENDING table itab2 where " &amp;lt;- add APPENDING
OBJECTID = ITAB-VBELN AND
TABNAME = 'VBAP' AND
FNAME = 'NETPR'.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 05:50:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449214#M1413455</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-21T05:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: select query doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449215#M1413456</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;  Just do like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from cdpos into table itab2 for all entries in itab&lt;/P&gt;&lt;P&gt;			where objectid = itab-vbeln and&lt;/P&gt;&lt;P&gt;			      tabname  = 'VBAP' and&lt;/P&gt;&lt;P&gt;			      fname = 'NETPR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ramesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 05:51:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449215#M1413456</guid>
      <dc:creator>former_member282823</dc:creator>
      <dc:date>2009-12-21T05:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: select query doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449216#M1413457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;please use " for all entries "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 05:53:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449216#M1413457</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-21T05:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: select query doubt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449217#M1413458</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;  instead of using the select statement inside the loop,try to use the  select statement using FOR ALL ENTRIES in ITAB1. &lt;/P&gt;&lt;P&gt;Data type of the fields in the where condition needs to be same as that of CDPOS table variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2009 05:53:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-doubt/m-p/6449217#M1413458</guid>
      <dc:creator>nirajgadre</dc:creator>
      <dc:date>2009-12-21T05:53:25Z</dc:date>
    </item>
  </channel>
</rss>

