<?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/3565767#M858107</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;Before using for all entries you have the check the data existency in internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT  iT_BKPF[] IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select BUKRS BELNR GJAHR &lt;/P&gt;&lt;P&gt;          BSCHL MwSKZ SHKZG&lt;/P&gt;&lt;P&gt;          WRBTR From BSEG&lt;/P&gt;&lt;P&gt; Into table iT_BSEG &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN iT_BKPF&lt;/P&gt;&lt;P&gt;Where BUKRS = iT_BKPF-BUKRS and&lt;/P&gt;&lt;P&gt;           GJAHR = it_bkpf-GJAHR and&lt;/P&gt;&lt;P&gt;           BELNR = iT_BKPF-BELNR and&lt;/P&gt;&lt;P&gt;           mwskz eq taxcode and&lt;/P&gt;&lt;P&gt;           lifnr eq vendor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Mar 2008 06:52:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-21T06:52:36Z</dc:date>
    <item>
      <title>select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565765#M858105</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;why this is taking too much time for execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select BUKRS BELNR GJAHR BSCHL MwSKZ SHKZG WRBTR From BSEG Into&lt;/P&gt;&lt;P&gt;table iT_BSEG where&lt;/P&gt;&lt;P&gt;         FOR ALL ENTRIES IN iT_BKPF&lt;/P&gt;&lt;P&gt;         Where BUKRS = iT_BKPF-BUKRS and&lt;/P&gt;&lt;P&gt;         GJAHR = it_bkpf-GJAHR and&lt;/P&gt;&lt;P&gt;         BELNR = iT_BKPF-BELNR and&lt;/P&gt;&lt;P&gt;         mwskz eq taxcode and&lt;/P&gt;&lt;P&gt;         lifnr eq vendor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can any one help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Santosini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 05:55:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565765#M858105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T05:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565766#M858106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You had put the two where clause in the select statment query&lt;/P&gt;&lt;P&gt;and what is the tax code and vendor in your query. If they are local variables then you will try this : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select BUKRS BELNR GJAHR BSCHL MwSKZ SHKZG WRBTR From BSEG Into&lt;/P&gt;&lt;P&gt;table iT_BSEG &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN iT_BKPF&lt;/P&gt;&lt;P&gt;Where BUKRS = iT_BKPF-BUKRS and&lt;/P&gt;&lt;P&gt;GJAHR = it_bkpf-GJAHR and&lt;/P&gt;&lt;P&gt;BELNR = iT_BKPF-BELNR and&lt;/P&gt;&lt;P&gt;mwskz eq taxcode and&lt;/P&gt;&lt;P&gt;lifnr eq vendor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Reward if helpfull&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Anuj Garg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 06:37:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565766#M858106</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T06:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565767#M858107</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;Before using for all entries you have the check the data existency in internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT  iT_BKPF[] IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select BUKRS BELNR GJAHR &lt;/P&gt;&lt;P&gt;          BSCHL MwSKZ SHKZG&lt;/P&gt;&lt;P&gt;          WRBTR From BSEG&lt;/P&gt;&lt;P&gt; Into table iT_BSEG &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN iT_BKPF&lt;/P&gt;&lt;P&gt;Where BUKRS = iT_BKPF-BUKRS and&lt;/P&gt;&lt;P&gt;           GJAHR = it_bkpf-GJAHR and&lt;/P&gt;&lt;P&gt;           BELNR = iT_BKPF-BELNR and&lt;/P&gt;&lt;P&gt;           mwskz eq taxcode and&lt;/P&gt;&lt;P&gt;           lifnr eq vendor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 06:52:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565767#M858107</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T06:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565768#M858108</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;but why its taking a long time to fetch data.&lt;/P&gt;&lt;P&gt;how i will reduce the execution time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 07:07:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565768#M858108</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T07:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565769#M858109</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;Remove the two where clause.&lt;/P&gt;&lt;P&gt;Sort the internbal table iT_BSEG  with the bukrs gjahr belnr before data retreival.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sourabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 10:22:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565769#M858109</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T10:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565770#M858110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should Consider this too&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The order fields in the select statement should be same as the oreder of fields in the database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select &lt;STRONG&gt;BUKRS BELNR GJAHR BSCHL SHKZG MwSKZ WRBTR&lt;/STRONG&gt; From BSEG Into&lt;/P&gt;&lt;P&gt;table iT_BSEG where&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN iT_BKPF&lt;/P&gt;&lt;P&gt;Where BUKRS = iT_BKPF-BUKRS and&lt;/P&gt;&lt;P&gt;GJAHR = it_bkpf-GJAHR and&lt;/P&gt;&lt;P&gt;BELNR = iT_BKPF-BELNR and&lt;/P&gt;&lt;P&gt;mwskz eq taxcode and&lt;/P&gt;&lt;P&gt;lifnr eq vendor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 10:59:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565770#M858110</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T10:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565771#M858111</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;Initially, you populate the internal table "iT_BKPF" with necessary info and then, sort it and delete adjacent rows from it and keep it ready....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, write the Select query as under:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select&lt;/P&gt;&lt;P&gt;BUKRS BELNR GJAHR BSCHL MWSKZ SHKZG WRBTR From BSEG Into&lt;/P&gt;&lt;P&gt;table IT_BSEG &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN IT_BKPF&lt;/P&gt;&lt;P&gt;Where &lt;/P&gt;&lt;P&gt;BUKRS = IT_BKPF-BUKRS&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;GJAHR = it_bkpf-GJAHR &lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;BELNR = iT_BKPF-BELNR &lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;mwskz eq taxcode &lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;lifnr eq vendor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some more ideas:&lt;/P&gt;&lt;P&gt;-&amp;gt; try to arrange the fields in the Select in proper order as they  were place in the DB table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; if this also does not solve the purpose, try creating Secondary index on the some of the fields ( which were not there in the primary key fields ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then, check if the performance has improved or not...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vishnu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 11:56:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565771#M858111</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T11:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565772#M858112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi santosh.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ur taking two itabs. and populating the values into 1st table and then ur using SELECT statemet.by these two times the db tables hs to be read.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u do one thing......&lt;/P&gt;&lt;P&gt;select te data directly from db table....&lt;/P&gt;&lt;P&gt;that is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT........&lt;/P&gt;&lt;P&gt;FROM &amp;lt;DB TABLE &amp;gt; (NOT ITAB)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY THIS....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u get answer plz reply me&lt;/P&gt;&lt;P&gt;bye tc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2008 19:26:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565772#M858112</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-21T19:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565773#M858113</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;It is taking more time because it_bkpf has huge number of data, may be above 20 thousand entries for a single bukrs e.g. 1000. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please restrict the selection for it_bkpf if possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can also code to avoid duplicates in it_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SORT it_bkpf BY bukrs belnr gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DELETE ADJACENT DUPLICATES FROM it_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT bukrs belnr gjahr bschl mwskz shkzg wrbtr lifnr FROM bseg&lt;/P&gt;&lt;P&gt;  INTO TABLE it_bseg&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN it_bkpf&lt;/P&gt;&lt;P&gt;  WHERE bukrs = it_bkpf-bukrs&lt;/P&gt;&lt;P&gt;  AND belnr = it_bkpf-belnr&lt;/P&gt;&lt;P&gt;  AND gjahr = it_bkpf-gjahr&lt;/P&gt;&lt;P&gt;  AND mwskz EQ taxcode&lt;/P&gt;&lt;P&gt;  AND lifnr EQ vendor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BSEG also has huge data, so care to be taken while firing query on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are able to restrict for it_bkpf then your problem will be resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward if useful.&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, 24 Mar 2008 06:59:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565773#M858113</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-24T06:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565774#M858114</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;u are very new in programming !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz do,  first declare the structure , then internal table , use without header line , then work area , then validate the fields , then use for all entries methord , it is very long process , u r proference will not low . because it is the best methord to join in application level, u r using wrong way , so do it proper way . Do it in production level programming way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks and regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mr. Subash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Mar 2008 15:38:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3565774#M858114</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-24T15:38:42Z</dc:date>
    </item>
  </channel>
</rss>

