<?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 Select Query performance issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939239#M942481</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Gurus,&lt;/P&gt;&lt;P&gt;Pls see the following query....its taking a lot time &amp;amp; giving runtime error TSV_TNEW_PAGE_ALLOC_FAILED as no of records being fetched is around 1950000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM bseg&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS* OF TABLE it_final&lt;/P&gt;&lt;P&gt;for all entries in t_bkpf where belnr = t_bkpf-belnr&lt;/P&gt;&lt;P&gt;and gjahr in so_gjahr and bukrs = 'NDPL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls see &amp;amp; tell hw cn i modify this. Also i m unable to find indexes for table bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnx.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 May 2008 13:10:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-27T13:10:19Z</dc:date>
    <item>
      <title>Select Query performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939239#M942481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Gurus,&lt;/P&gt;&lt;P&gt;Pls see the following query....its taking a lot time &amp;amp; giving runtime error TSV_TNEW_PAGE_ALLOC_FAILED as no of records being fetched is around 1950000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM bseg&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS* OF TABLE it_final&lt;/P&gt;&lt;P&gt;for all entries in t_bkpf where belnr = t_bkpf-belnr&lt;/P&gt;&lt;P&gt;and gjahr in so_gjahr and bukrs = 'NDPL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls see &amp;amp; tell hw cn i modify this. Also i m unable to find indexes for table bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnx.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 13:10:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939239#M942481</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T13:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939240#M942482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;don't use INTO CORRESPONDING FIELDS .. instead&lt;/P&gt;&lt;P&gt;use into table .. also choose the fields U want and not all&lt;/P&gt;&lt;P&gt;from bseg .. &lt;/P&gt;&lt;P&gt;fields should be in the same order in where condition as&lt;/P&gt;&lt;P&gt;in the table ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not t_bkpf[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM bseg&lt;/P&gt;&lt;P&gt;INTO TABLE it_final&lt;/P&gt;&lt;P&gt;for all entries in t_bkpf &lt;/P&gt;&lt;P&gt;where bukrs = 'NDPL'&lt;/P&gt;&lt;P&gt;and    belnr = t_bkpf-belnr&lt;/P&gt;&lt;P&gt;and    gjahr in so_gjahr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 13:16:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939240#M942482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T13:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939241#M942483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add a check statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check not t_bkpf[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM bseg&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS* OF TABLE it_final&lt;/P&gt;&lt;P&gt;for all entries in t_bkpf where belnr = t_bkpf-belnr&lt;/P&gt;&lt;P&gt;and gjahr in so_gjahr and bukrs = 'NDPL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also dont use Select * into corresponding. Extract the fields you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 13:28:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939241#M942483</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T13:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939242#M942484</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;  While using the for all entries addition in select statement, the internal table should be sorted in your case t_bkpf should be sorted on belnr and also check t_bkpf has entries or not. Dont use *, instead use the fields of table. If u still get the problem while read data from bseg then try to use the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:n type i,&lt;/P&gt;&lt;P&gt;       lines_from type i,&lt;/P&gt;&lt;P&gt;       lines_to   type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table t_bkpf lines v_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;n = v_lines / 1000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if n = 0.&lt;/P&gt;&lt;P&gt;n = 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lines_from = 1.&lt;/P&gt;&lt;P&gt;Lines_to   = 1000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do n times&lt;/P&gt;&lt;P&gt;append LINES OF t_bkpf FROM lines_from TO lines_to to t_bkpf_temp.&lt;/P&gt;&lt;P&gt;SELECT * FROM bseg&lt;/P&gt;&lt;P&gt;INTO TABLE it_final&lt;/P&gt;&lt;P&gt;for all entries in t_bkpf_temp where belnr = t_bkpf_temp-belnr&lt;/P&gt;&lt;P&gt;and gjahr in so_gjahr and bukrs = 'NDPL'.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;appending lines of it_final to it_output.&lt;/P&gt;&lt;P&gt;refresh t_bkpf_temp.&lt;/P&gt;&lt;P&gt;lines_from = lines_from + 1000.&lt;/P&gt;&lt;P&gt;lines_to   = lines_to + 1000.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;enddo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will definatly helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 13:33:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939242#M942484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T13:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939243#M942485</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 need to be very careful enough while retrieving data from Clustered/Pooled tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. You should not use * instead use necessary fields.&lt;/P&gt;&lt;P&gt;2. Don't use into corresponding fields statement, rather you can use into table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 13:39:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939243#M942485</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T13:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939244#M942486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add GJAHR to T_BKPF and use that in the SELECT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM bseg
  INTO CORRESPONDING FIELDS OF TABLE it_final
  for all entries in t_bkpf 
  where bukrs = 'NDPL'
    and belnr = t_bkpf-belnr
    and gjahr = t_bkpf-gjahr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 14:17:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/3939244#M942486</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T14:17:23Z</dc:date>
    </item>
  </channel>
</rss>

