<?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: performance issue in this query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028012#M1169646</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;select kunnr&lt;/P&gt;&lt;P&gt;name1&lt;/P&gt;&lt;P&gt;land1&lt;/P&gt;&lt;P&gt;regio&lt;/P&gt;&lt;P&gt;ktokd&lt;/P&gt;&lt;P&gt;from kna1&lt;/P&gt;&lt;P&gt;into table it_kna1&lt;/P&gt;&lt;P&gt;for all entries in it_knb1&lt;/P&gt;&lt;P&gt;where kunnr = it_knb1-kunnr&lt;/P&gt;&lt;P&gt;and ktokd = '0003'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Here you are not checking whether IT_KNB1 is filled with some records or not. SO it wil not check for&lt;/P&gt;&lt;P&gt;the KUNNR value.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_kna1 by kunnr.&lt;/P&gt;&lt;P&gt;Better to use delete adjacent duplicates.&lt;/P&gt;&lt;P&gt;if you want all the records, the copy the contents into a local internal table and then delete &lt;/P&gt;&lt;P&gt;the adjacent duplicates and use this in your select query.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkatesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Jan 2009 10:32:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-12T10:32:01Z</dc:date>
    <item>
      <title>performance issue in this query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028010#M1169644</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 getting the performnace issue in the query for vbrk,vbpa and knc1.because the key field are not used for the linking tables.infact not getting any ouput from the fetch of knc1.&lt;/P&gt;&lt;P&gt;kindly reply with suggestio&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select kunnr
       bukrs
       from knb1
       into corresponding fields of table it_knb1
       where bukrs IN s_ccode.

if sy-subrc = 0.

sort it_knb1 descending by kunnr.

endif.

select kunnr
       name1
       land1
       regio
       ktokd
       from kna1
       into table it_kna1
       for all entries in it_knb1
       where kunnr = it_knb1-kunnr
       and ktokd = '0003'.

 if sy-subrc = 0.

sort it_kna1  by kunnr.
endif.

if not it_kna1[] is initial.

 select vbeln
        kunrg
        fkdat
        kkber
        from vbrk
        into table it_vbrk
        for all entries in it_kna1
        where kunrg = it_kna1-kunnr.

if sy-subrc = 0.

sort it_vbrk descending by fkdat vbeln.
 endif.
 endif.

 if not it_vbrk[] is initial.

 select vbeln
        parvw
        pernr
        kunnr
        from vbpa
        into table it_vbpa
        for all entries in it_vbrk
        where vbeln = it_vbrk-vbeln
        and kunnr = it_vbrk-kunrg
        and parvw = 'VE'.

 if sy-subrc = 0.
 sort it_vbpa by vbeln.
 endif.
 endif.

 if sy-subrc = 0.

 select kunnr
        kkber
        sbgrp
        from knkk
        into table it_knkk
        for all entries in it_kna1
        where kunnr = it_kna1-kunnr.

 if sy-subrc = 0.
 sort it_knkk by kunnr.
 endif.
 endif.

 if not it_knkk[] is initial.

 select kunnr
        zterm
        from knvv
        into table it_knvv
        for all entries in it_knkk
        where kunnr = it_knkk-kunnr.

if sy-subrc = 0.
sort it_knvv by kunnr.

endif.
endif.

CLEAR: v_year.

read table it_vbrk index 1.

write it_vbrk-fkdat to v_year dd/mm/yyyy.

v_year = v_year+6(4).

if sy-subrc = 0.

select kunnr
       bukrs
       gjahr
       UM01U
       UM02U
       UM03U
       UM04U
       UM05U
       UM06U
       UM07U
       UM08U
       UM09U
       UM10U
       UM11U
       UM12U
       from knc1
       into table it_knc1
*       for all entries in it_vbrk
*       where kunnr = it_vbrk-kunrg
       for all entries in it_knb1
       where bukrs = it_knb1-bukrs
       and   gjahr = v_year.

if sy-subrc = 0.
sort it_knc1 descending  by gjahr.
endif.

 endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Julius Bussche on Jan 12, 2009 11:54 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2009 10:18:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028010#M1169644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-12T10:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue in this query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028011#M1169645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the first select statement you have used into corresponding statement ...this is a problem here i guess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Insted you can used &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select kunnr&lt;/P&gt;&lt;P&gt;bukrs&lt;/P&gt;&lt;P&gt;from knb1&lt;/P&gt;&lt;P&gt;into table &lt;STRONG&gt;it_knb1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;where bukrs IN s_ccode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Provided it_knb1  has a structure of only kunnr and  bukrs fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2009 10:23:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028011#M1169645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-12T10:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue in this query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028012#M1169646</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;select kunnr&lt;/P&gt;&lt;P&gt;name1&lt;/P&gt;&lt;P&gt;land1&lt;/P&gt;&lt;P&gt;regio&lt;/P&gt;&lt;P&gt;ktokd&lt;/P&gt;&lt;P&gt;from kna1&lt;/P&gt;&lt;P&gt;into table it_kna1&lt;/P&gt;&lt;P&gt;for all entries in it_knb1&lt;/P&gt;&lt;P&gt;where kunnr = it_knb1-kunnr&lt;/P&gt;&lt;P&gt;and ktokd = '0003'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Here you are not checking whether IT_KNB1 is filled with some records or not. SO it wil not check for&lt;/P&gt;&lt;P&gt;the KUNNR value.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_kna1 by kunnr.&lt;/P&gt;&lt;P&gt;Better to use delete adjacent duplicates.&lt;/P&gt;&lt;P&gt;if you want all the records, the copy the contents into a local internal table and then delete &lt;/P&gt;&lt;P&gt;the adjacent duplicates and use this in your select query.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkatesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2009 10:32:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028012#M1169646</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-12T10:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue in this query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028013#M1169647</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;put a break-point in each select query and check which select query is taking too much time..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and let us know, so that we can say what we need to change..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2009 10:32:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028013#M1169647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-12T10:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue in this query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028014#M1169648</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;after first select, create a temp internal table with same structure as it_knb1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_tmp [ ] = it_knb1 [ ] .&lt;/P&gt;&lt;P&gt;sort i_tmp by kunnr.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from i_tmp comparing kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select kunnr&lt;/P&gt;&lt;P&gt;name1&lt;/P&gt;&lt;P&gt;land1&lt;/P&gt;&lt;P&gt;regio&lt;/P&gt;&lt;P&gt;ktokd&lt;/P&gt;&lt;P&gt;from kna1&lt;/P&gt;&lt;P&gt;into table it_kna1&lt;/P&gt;&lt;P&gt;for all entries in i_tmp &lt;/P&gt;&lt;P&gt;where kunnr = i_tmp -kunnr&lt;/P&gt;&lt;P&gt;and ktokd = '0003'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For select from  KNVV, use iternal table  IT_KNA1 instead&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select kunnr&lt;/P&gt;&lt;P&gt;zterm&lt;/P&gt;&lt;P&gt;from knvv&lt;/P&gt;&lt;P&gt;into table it_knvv&lt;/P&gt;&lt;P&gt;for all entries in it_kna1&lt;/P&gt;&lt;P&gt;where kunnr = it_kna1-kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will speedup your retrieval.&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;Dev.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2009 10:32:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028014#M1169648</guid>
      <dc:creator>dev_parbutteea</dc:creator>
      <dc:date>2009-01-12T10:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue in this query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028015#M1169649</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;In the first select query , avoid statement into corresponding and before the second select query u have to use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it_knb1[] is not initial. &lt;/P&gt;&lt;P&gt;select kunnr&lt;/P&gt;&lt;P&gt;name1&lt;/P&gt;&lt;P&gt;land1&lt;/P&gt;&lt;P&gt;regio&lt;/P&gt;&lt;P&gt;ktokd&lt;/P&gt;&lt;P&gt;from kna1&lt;/P&gt;&lt;P&gt;into table it_kna1&lt;/P&gt;&lt;P&gt;for all entries in it_knb1&lt;/P&gt;&lt;P&gt;where kunnr = it_knb1-kunnr&lt;/P&gt;&lt;P&gt;and ktokd = '0003'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aslo in the below query , u have to change the partner type.instead of VE u have to give WE...Plz check&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not it_vbrk[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select vbeln&lt;/P&gt;&lt;P&gt;parvw&lt;/P&gt;&lt;P&gt;pernr&lt;/P&gt;&lt;P&gt;kunnr&lt;/P&gt;&lt;P&gt;from vbpa&lt;/P&gt;&lt;P&gt;into table it_vbpa&lt;/P&gt;&lt;P&gt;for all entries in it_vbrk&lt;/P&gt;&lt;P&gt;where vbeln = it_vbrk-vbeln&lt;/P&gt;&lt;P&gt;and kunnr = it_vbrk-kunrg&lt;/P&gt;&lt;P&gt;and parvw = 'WE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;sort it_vbpa by vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&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;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2009 10:34:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028015#M1169649</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2009-01-12T10:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue in this query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028016#M1169650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tanisha,&lt;/P&gt;&lt;P&gt;I would have written a JOIN query in this case.&lt;/P&gt;&lt;P&gt;Do let me know if i shud be putting efforts on the queries to JOIN them together.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2009 10:36:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-this-query/m-p/5028016#M1169650</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-12T10:36:53Z</dc:date>
    </item>
  </channel>
</rss>

