<?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/4026382#M962249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hiii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using BSID, BSAD, BSIK BSAK... views then BSEG table. These all  are spin offs of the bseg table which will give a better performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jun 2008 09:54:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-20T09:54:51Z</dc:date>
    <item>
      <title>select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026380#M962247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP masters,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have requirement where I am fetching data from BKPF and BSEG.&lt;/P&gt;&lt;P&gt;since BSEG is cluster table it is not allowing me to use JOIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I am fetching data as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT&lt;/P&gt;&lt;P&gt;BKPF~BUKRS&lt;/P&gt;&lt;P&gt;BKPF~BELNR&lt;/P&gt;&lt;P&gt;BKPF~GJAHR&lt;/P&gt;&lt;P&gt;BKPF~BLART&lt;/P&gt;&lt;P&gt;BKPF~BLDAT&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE ITAB&lt;/P&gt;&lt;P&gt;  FROM BKPF&lt;/P&gt;&lt;P&gt;  WHERE BUKRS IN BUKRS&lt;/P&gt;&lt;P&gt;  AND GJAHR EQ GJAHR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SORT ITAB BY BUKRS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT&lt;/P&gt;&lt;P&gt;    BSEG~ZFBDT&lt;/P&gt;&lt;P&gt;    BSEG~UMSKZ&lt;/P&gt;&lt;P&gt;    BSEG~DMBTR&lt;/P&gt;&lt;P&gt;    BSEG~WRBTR&lt;/P&gt;&lt;P&gt;    BSEG~PSWBT&lt;/P&gt;&lt;P&gt;    BSEG~PSWSL&lt;/P&gt;&lt;P&gt;    BSEG~AUGBL&lt;/P&gt;&lt;P&gt;    BSEG~SGTXT&lt;/P&gt;&lt;P&gt;    FROM BSEG INTO WA&lt;/P&gt;&lt;P&gt;    WHERE BUKRS EQ WA-BUKRS&lt;/P&gt;&lt;P&gt;    AND GJAHR EQ WA-GJAHR&lt;/P&gt;&lt;P&gt;    AND BELNR EQ WA-BELNR.&lt;/P&gt;&lt;P&gt;      MODIFY ITAB FROM WA.&lt;/P&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know is there , performance wise , better option to fetch this data ,shall I use nested select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any inputs on why this is not good would help me in future&lt;/P&gt;&lt;P&gt;thanks and Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 09:41:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026380#M962247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T09:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026381#M962248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi anirudh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  I think u want to get afinal internal table from both BKPF and BSEG tables.&lt;/P&gt;&lt;P&gt;  So first u retrieve the data from BKPF and check sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  Then retreive data from BSEG using "For All entreis".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  But be clear in where condition using which fiedls u want to filter the data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  As in the sencond query u fetched the data into WA and u &lt;/P&gt;&lt;P&gt;are checking where with the fields in WA .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Ur first internal table chould be WA&lt;/P&gt;&lt;P&gt;   then second could be ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Now u can do ur coding.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;BKPF~BUKRS&lt;/P&gt;&lt;P&gt;BKPF~BELNR&lt;/P&gt;&lt;P&gt;BKPF~GJAHR&lt;/P&gt;&lt;P&gt;BKPF~BLART&lt;/P&gt;&lt;P&gt;BKPF~BLDAT&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE wa&lt;/P&gt;&lt;P&gt;FROM BKPF&lt;/P&gt;&lt;P&gt;WHERE BUKRS IN BUKRS&lt;/P&gt;&lt;P&gt;AND GJAHR EQ GJAHR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY BUKRS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;BSEG~ZFBDT&lt;/P&gt;&lt;P&gt;BSEG~UMSKZ&lt;/P&gt;&lt;P&gt;BSEG~DMBTR&lt;/P&gt;&lt;P&gt;BSEG~WRBTR&lt;/P&gt;&lt;P&gt;BSEG~PSWBT&lt;/P&gt;&lt;P&gt;BSEG~PSWSL&lt;/P&gt;&lt;P&gt;BSEG~AUGBL&lt;/P&gt;&lt;P&gt;BSEG~SGTXT&lt;/P&gt;&lt;P&gt;FROM BSEG INTO itab&lt;/P&gt;&lt;P&gt;for all entries in wa&lt;/P&gt;&lt;P&gt;WHERE BUKRS EQ WA-BUKRS&lt;/P&gt;&lt;P&gt;AND GJAHR EQ WA-GJAHR&lt;/P&gt;&lt;P&gt;AND BELNR EQ WA-BELNR.&lt;/P&gt;&lt;P&gt;MODIFY ITAB FROM WA.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 09:54:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026381#M962248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T09:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026382#M962249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hiii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using BSID, BSAD, BSIK BSAK... views then BSEG table. These all  are spin offs of the bseg table which will give a better performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 09:54:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026382#M962249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T09:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026383#M962250</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;First get the required data from BKPF table after the select query check the sy-subrc. If it is not zero then sort the i_bkpf and retrieve data from BSEG using SELECT with FOR ALL ENTRIES addition. Check the internal table is initial or not before use that for FOR ALL ENTRIES. Then finally using Loop you can prepare final internal table.&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>Fri, 20 Jun 2008 09:58:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026383#M962250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T09:58: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/4026384#M962251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your valuable reply&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sorry i did not mention that &lt;/P&gt;&lt;P&gt;itab is my internal table without header &lt;/P&gt;&lt;P&gt;and wa is my work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not using two internal table at first place.&lt;/P&gt;&lt;P&gt;shall I use two intrenal table and then populate the data into third&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;again my initial doubt is that what method i should follow to have best performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have got tables BSIK AND BSEG in my func specs&lt;/P&gt;&lt;P&gt;so if I use any other table , is it advisable.&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;ani&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: aniruddha surve on Jun 20, 2008 12:44 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 10:39:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026384#M962251</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T10:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026385#M962252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi aniruddha surve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its better to get all the entries in to one table and then do processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT...ENDSELECT decreases performance of the program.&lt;/P&gt;&lt;P&gt;Because it hits the database several times.&lt;/P&gt;&lt;P&gt;its not good to hit the data base several time .&lt;/P&gt;&lt;P&gt;first get all the required data in to ur internal table and then process the internal table to get the required result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 10:50:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026385#M962252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T10:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026386#M962253</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;To get the best performance use the &lt;STRONG&gt;Logical Database SDF&lt;/STRONG&gt; which enhances the performace when queying for BSEG table .This happens because parallel processing happens and 2 programs run in the background.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R Adarsh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 10:51:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/4026386#M962253</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T10:51:51Z</dc:date>
    </item>
  </channel>
</rss>

