<?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: ABAP Select Query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191944#M1519955</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; I am doing like what you people have mentioned only. But since my standard table has around 6 lakh entries and when i use less than condition date it is taking around 5 mins to execute that query. &lt;/P&gt;&lt;P&gt;Is there any way to resolve this performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to use not in select query for two tables. kindly let me know is there any way to use 'NOT IN' for tables in select query.&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;Sridevi S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Aug 2010 11:02:28 GMT</pubDate>
    <dc:creator>former_member671009</dc:creator>
    <dc:date>2010-08-19T11:02:28Z</dc:date>
    <item>
      <title>ABAP Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191940#M1519951</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;    I am running one report program where the user gives only the date in the selection screen. I need to select all the document number which has not been sent before and equal to that date and send as file to another system. I have one standard table and custom ztable. I will be updating the document number,store number and posting date of the document in the ztable once the file is sent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to put a query where i need to compare the date as less than equal to selection screen date and I should select only the document numbers that is not existing in my ztable. &lt;/P&gt;&lt;P&gt;How to proceed on this query??&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;Sridevi S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 10:19:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191940#M1519951</guid>
      <dc:creator>former_member671009</dc:creator>
      <dc:date>2010-08-19T10:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191941#M1519952</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;Highlevel code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select from Standard Table where date&amp;lt;=p_date into table tbl1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select from "Z" table where document number = tbl1-docno.&lt;/P&gt;&lt;P&gt;into table tbl2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop on tbl2&lt;/P&gt;&lt;P&gt;read table tbl1 where tbl1-docno = tbl2-docno&lt;/P&gt;&lt;P&gt;if found &lt;/P&gt;&lt;P&gt;delete record in tbl1&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;TBL1 is your final table which need to transferred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dont think of single query for the same. If by any chance you are able to create such query it will be very poor performing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Arun Singhal on Aug 19, 2010 12:33 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 10:31:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191941#M1519952</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-19T10:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191942#M1519953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sridevi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer the below code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

SELECT DOC_NR 
       FIELDY 
       FIELDZ 
       FROM STANDARD TABLE INTO 
       TABLE ITAB WHERE DATE IN S_DATE 

SELECT DOC_NR 
       FROM ZTABLE INTO TABLE ITAB1 
       FOR ALL ENTRIES IN ITAB-DOC_NR
       WHERE DOC_NR = ITAB_DOC_NR.


LOOP AT ITAB1.
READ TABLE ITAB WITH KEY DOC_NR = ITAB1-DOC_NR.

IF SY-SUBRC = 0.
DELETE TABLE ITAB FROM ITAB.
ENDIF.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Close the thread if this solves your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 10:42:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191942#M1519953</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-19T10:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191943#M1519954</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 can follow below code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select * from standard table into I_itab where date LE P_date.

Select * from custome table for all entries in i_itab into i_itab1 where document number = i_itab-document number.

Loop at i_itab into wa_itab.
   v_index = sy-tabix.
   
   read table i_itab1 into wa_itab1 where document number = wa_itab-document number.
   if sy-subrc EQ 0.
      delete i_itab index v_index.
   endif.
clear: wa_itab1, wa_itab, sy-tabix.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Archana Pawar on Aug 19, 2010 12:51 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 10:49:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191943#M1519954</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-19T10:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191944#M1519955</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; I am doing like what you people have mentioned only. But since my standard table has around 6 lakh entries and when i use less than condition date it is taking around 5 mins to execute that query. &lt;/P&gt;&lt;P&gt;Is there any way to resolve this performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to use not in select query for two tables. kindly let me know is there any way to use 'NOT IN' for tables in select query.&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;Sridevi S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 11:02:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191944#M1519955</guid>
      <dc:creator>former_member671009</dc:creator>
      <dc:date>2010-08-19T11:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Select Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191945#M1519956</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;Dont use NOT IN or negative statements in select queries. They are ver poor performing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to identify secondary index keys with date field and if possible try using them in your query &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If no index found try with other seconday index keys.&lt;/P&gt;&lt;P&gt;Delete records where date &amp;lt;= selection date&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;in loop put the above statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 11:22:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-select-query/m-p/7191945#M1519956</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-19T11:22:22Z</dc:date>
    </item>
  </channel>
</rss>

