<?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 tuning: Retrieving data from 4 tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020278#M714007</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;don't use JOIN for 4 tables use FOR ALL ENTRIES &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because if use JOIN for that 4 tables the join will exit for that tables until the program execution which results in load on database and it will reduce the performance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if use FOR ALL ENTRIES then at once it will retrive the data and there won't be any load on database result in good performance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use like this &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 OTYPE&lt;/P&gt;&lt;P&gt;         OBJID&lt;/P&gt;&lt;P&gt;         RELAT&lt;/P&gt;&lt;P&gt;         BEGDA&lt;/P&gt;&lt;P&gt;         ENDDA&lt;/P&gt;&lt;P&gt;         SCLAS&lt;/P&gt;&lt;P&gt;         SOBID FROM HRP1001 INTO TABLE IT_HRP1001&lt;/P&gt;&lt;P&gt;                    WHERE OTYPE = 'D'&lt;/P&gt;&lt;P&gt;                        AND OBJID IN S_OBJID&lt;/P&gt;&lt;P&gt;                        AND BEGDA GE DATE-LOW&lt;/P&gt;&lt;P&gt;                        AND ENDDA LE DATE-HIGH&lt;/P&gt;&lt;P&gt;                        AND ( SCLAS = 'E' OR SCLAS = 'ET' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;    MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  SELECT OTYPE&lt;/P&gt;&lt;P&gt;         OBJID&lt;/P&gt;&lt;P&gt;         AEDTM&lt;/P&gt;&lt;P&gt;         UNAME&lt;/P&gt;&lt;P&gt;         DELET&lt;/P&gt;&lt;P&gt;         CANCR&lt;/P&gt;&lt;P&gt;         FROM HRP1026&lt;/P&gt;&lt;P&gt;          INTO TABLE IT_HRP1026&lt;/P&gt;&lt;P&gt;          FOR ALL ENTRIES IN IT_SOBID&lt;/P&gt;&lt;P&gt;             WHERE OBJID = IT_SOBID-SOBID&lt;/P&gt;&lt;P&gt;             AND ( OTYPE = 'E' OR OTYPE = 'ET' )&lt;/P&gt;&lt;P&gt;                 AND DELET = 'X' AND&lt;/P&gt;&lt;P&gt;                 BEGDA GE DATE-LOW  AND&lt;/P&gt;&lt;P&gt;                 ENDDA LE DATE-HIGH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT OBJID&lt;/P&gt;&lt;P&gt;           STEXT&lt;/P&gt;&lt;P&gt;           FROM HRP1000&lt;/P&gt;&lt;P&gt;           INTO TABLE IT_HRP1000&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN IT_SOBID&lt;/P&gt;&lt;P&gt;              WHERE OBJID = IT_SOBID-SOBID AND&lt;/P&gt;&lt;P&gt;                    BEGDA GE DATE-LOW  AND&lt;/P&gt;&lt;P&gt;                    ENDDA LE DATE-HIGH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT CANCR&lt;/P&gt;&lt;P&gt;           CANCRT&lt;/P&gt;&lt;P&gt;           FROM T77CRT&lt;/P&gt;&lt;P&gt;           INTO TABLE IT_REASON&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN _HRP1000&lt;/P&gt;&lt;P&gt;           WHERE CANCR = IT_HRP1026-CANCR&lt;/P&gt;&lt;P&gt;             AND LANGU = 'E' .&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;use in this way FOR ALL ENTRIES &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if usefull&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Nov 2007 05:34:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-12T05:34:32Z</dc:date>
    <item>
      <title>Performance tuning: Retrieving data from 4 tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020277#M714006</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;Please find below a select stmt and recommend a better one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;belnr a&lt;/SUB&gt;bldat a&lt;SUB&gt;budat a&lt;/SUB&gt;monat a&lt;SUB&gt;usnam a&lt;/SUB&gt;bktxt a&lt;SUB&gt;waers b&lt;/SUB&gt;racct b&lt;SUB&gt;wsl b&lt;/SUB&gt;drcrk b&lt;SUB&gt;buzei c&lt;/SUB&gt;txt50 d~altkt&lt;/P&gt;&lt;P&gt;                                            into table gt_all&lt;/P&gt;&lt;P&gt;                                            from bkpf as a inner join faglflexa as b on a&lt;SUB&gt;belnr = b&lt;/SUB&gt;docnr&lt;/P&gt;&lt;P&gt;                                            inner join skat as c on b&lt;SUB&gt;racct = c&lt;/SUB&gt;saknr&lt;/P&gt;&lt;P&gt;                                            inner join skb1 as d on c&lt;SUB&gt;saknr = d&lt;/SUB&gt;saknr&lt;/P&gt;&lt;P&gt;                                            where a~bukrs = p_bukrs and&lt;/P&gt;&lt;P&gt;                                                  a~gjahr = p_gjahr and&lt;/P&gt;&lt;P&gt;                                                  a~blart = p_blart and&lt;/P&gt;&lt;P&gt;                                                  a~budat in s_budat and&lt;/P&gt;&lt;P&gt;                                                  a~monat in s_monat and&lt;/P&gt;&lt;P&gt;                                                  b~ryear = p_gjahr and&lt;/P&gt;&lt;P&gt;                                                  b~rbukrs = p_bukrs and&lt;/P&gt;&lt;P&gt;                                                  b~rldnr = '0L' and&lt;/P&gt;&lt;P&gt;                                                  b~rvers = '001'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points awaiting.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Younus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 05:06:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020277#M714006</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T05:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning: Retrieving data from 4 tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020278#M714007</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;don't use JOIN for 4 tables use FOR ALL ENTRIES &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because if use JOIN for that 4 tables the join will exit for that tables until the program execution which results in load on database and it will reduce the performance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if use FOR ALL ENTRIES then at once it will retrive the data and there won't be any load on database result in good performance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use like this &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 OTYPE&lt;/P&gt;&lt;P&gt;         OBJID&lt;/P&gt;&lt;P&gt;         RELAT&lt;/P&gt;&lt;P&gt;         BEGDA&lt;/P&gt;&lt;P&gt;         ENDDA&lt;/P&gt;&lt;P&gt;         SCLAS&lt;/P&gt;&lt;P&gt;         SOBID FROM HRP1001 INTO TABLE IT_HRP1001&lt;/P&gt;&lt;P&gt;                    WHERE OTYPE = 'D'&lt;/P&gt;&lt;P&gt;                        AND OBJID IN S_OBJID&lt;/P&gt;&lt;P&gt;                        AND BEGDA GE DATE-LOW&lt;/P&gt;&lt;P&gt;                        AND ENDDA LE DATE-HIGH&lt;/P&gt;&lt;P&gt;                        AND ( SCLAS = 'E' OR SCLAS = 'ET' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;    MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  SELECT OTYPE&lt;/P&gt;&lt;P&gt;         OBJID&lt;/P&gt;&lt;P&gt;         AEDTM&lt;/P&gt;&lt;P&gt;         UNAME&lt;/P&gt;&lt;P&gt;         DELET&lt;/P&gt;&lt;P&gt;         CANCR&lt;/P&gt;&lt;P&gt;         FROM HRP1026&lt;/P&gt;&lt;P&gt;          INTO TABLE IT_HRP1026&lt;/P&gt;&lt;P&gt;          FOR ALL ENTRIES IN IT_SOBID&lt;/P&gt;&lt;P&gt;             WHERE OBJID = IT_SOBID-SOBID&lt;/P&gt;&lt;P&gt;             AND ( OTYPE = 'E' OR OTYPE = 'ET' )&lt;/P&gt;&lt;P&gt;                 AND DELET = 'X' AND&lt;/P&gt;&lt;P&gt;                 BEGDA GE DATE-LOW  AND&lt;/P&gt;&lt;P&gt;                 ENDDA LE DATE-HIGH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT OBJID&lt;/P&gt;&lt;P&gt;           STEXT&lt;/P&gt;&lt;P&gt;           FROM HRP1000&lt;/P&gt;&lt;P&gt;           INTO TABLE IT_HRP1000&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN IT_SOBID&lt;/P&gt;&lt;P&gt;              WHERE OBJID = IT_SOBID-SOBID AND&lt;/P&gt;&lt;P&gt;                    BEGDA GE DATE-LOW  AND&lt;/P&gt;&lt;P&gt;                    ENDDA LE DATE-HIGH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT CANCR&lt;/P&gt;&lt;P&gt;           CANCRT&lt;/P&gt;&lt;P&gt;           FROM T77CRT&lt;/P&gt;&lt;P&gt;           INTO TABLE IT_REASON&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN _HRP1000&lt;/P&gt;&lt;P&gt;           WHERE CANCR = IT_HRP1026-CANCR&lt;/P&gt;&lt;P&gt;             AND LANGU = 'E' .&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;use in this way FOR ALL ENTRIES &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if usefull&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 05:34:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020278#M714007</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T05:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning: Retrieving data from 4 tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020279#M714008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yonus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare independent internal table and 1 final table for each table and fetch data as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select belnr bldat budat monat usnam bktxt waers from bkpf into table it_bkpf where bukrs = p_bukrs and
gjahr = p_gjahr and
blart = p_blart and
budat in s_budat and
monat in s_monat.
if sy-subrc = 0.
 if it_bkpf[] is not initial.
  select docnr racct wsl drcrk buzei from faglflexa into table it_faglflexa
   for all entries in it_bkpf
   where docnr = it_bkpf-belnr and
            ryear = p_gjahr and
            rbukrs = p_bukrs and
            rldnr = '0L' and
            rvers = '001'.
   if sy-subrc = 0.
      if it_faglflexa[] is not intial.
         select saknr txt50 from skat into table it_skat
           for all entries in it_faglflexa
            where saknr = it_faglflexa-racct.
         if sy-subrc = 0.
          select saknr altkt from skb1 into table it_skb1 
           for all entries in it_skat
             where saknr = it_skat-saknr.
         endif.
      endif.
   endif.
 endif.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you get all the data to your internal tables, read one by one and move to final internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward for helpful answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 07:27:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020279#M714008</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T07:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning: Retrieving data from 4 tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020280#M714009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) Rather than using the inner-joins on 4 tables, it would be better to have individual select statements and reconciling&lt;/P&gt;&lt;P&gt;the data later into one single table.&lt;/P&gt;&lt;P&gt;2) Fetch data from BKPF based on the information you have, i.e.&lt;/P&gt;&lt;P&gt;	select bukrs gjahr belnr bldat budat monat usnam bktxt waers&lt;/P&gt;&lt;P&gt;	from bkpf&lt;/P&gt;&lt;P&gt;	into table t_bkpf&lt;/P&gt;&lt;P&gt;	where bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;	  and gjahr = p_gjahr&lt;/P&gt;&lt;P&gt;          and blart = p_blart&lt;/P&gt;&lt;P&gt;          and budat in s_budat&lt;/P&gt;&lt;P&gt;          and monat in s_monat.&lt;/P&gt;&lt;P&gt;3) For all the entries selected above, fetch data from "FAGLFLEXA" based on the document number, fiscal year and company code&lt;/P&gt;&lt;P&gt;   in t_bkpf table. Based on the "KEY" in table "FAGLFLEXA" you may fetch more fields from BKPF if required.&lt;/P&gt;&lt;P&gt;	IF NOT t_bkpf[] IS INITIAL.&lt;/P&gt;&lt;P&gt;	  select rbukrs docnr rgjahr buzei racct wsl drcrk &lt;/P&gt;&lt;P&gt;	  from table faglflexa&lt;/P&gt;&lt;P&gt;	  into table t_fagl&lt;/P&gt;&lt;P&gt;          for all entries in t_bkpf&lt;/P&gt;&lt;P&gt;	  where rbukrs = t_bkpf-bukrs&lt;/P&gt;&lt;P&gt;            and rgjahr = t_bkpf-gjahr&lt;/P&gt;&lt;P&gt;            and docnr  = t_bkpf-belnr&lt;/P&gt;&lt;P&gt;            and rldnr  = 'OL'&lt;/P&gt;&lt;P&gt;            and rvers  = '001'.&lt;/P&gt;&lt;P&gt;	ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Selecting from SKAT. Based on the accounts obtained in t_fagl, we can get the G/L account long text from SKAT. But there&lt;/P&gt;&lt;P&gt;will be mulitple lines with same account in t_fagl. Also, while selecting from SKB1, G/L account and company code are the &lt;/P&gt;&lt;P&gt;details required for fetching the data.&lt;/P&gt;&lt;P&gt;So, may be you can take the data in t_fagl into some other internal table t_fagltemp.&lt;/P&gt;&lt;P&gt;SORT t_fagltemp BY BUKRS RACCT.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES in t_fagltemp COMPARING FIELDS BUKRS RACCT.&lt;/P&gt;&lt;P&gt;5) IF NOT t_fagltemp[] IS INITIAL.&lt;/P&gt;&lt;P&gt;     select spras ktopl saknr&lt;/P&gt;&lt;P&gt;     from SKAT&lt;/P&gt;&lt;P&gt;     INTO table t_skat&lt;/P&gt;&lt;P&gt;     for all entries in t_fagltemp&lt;/P&gt;&lt;P&gt;     where saknr = t_fagltemp-racct.&lt;/P&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;P&gt;   Here, if the company code i.e. p_bukrs is a parameter and mandatory field, then you can actualll get the language key&lt;/P&gt;&lt;P&gt;   i.e. field "SPRAS" from company code master data. And the same can be used in the above query on SKAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6) IF NOT t_fagltemp[] IS INITIAL.&lt;/P&gt;&lt;P&gt;     select bukrs saknr altkt&lt;/P&gt;&lt;P&gt;     FROM TABLE SKB1&lt;/P&gt;&lt;P&gt;     into table t_skb1&lt;/P&gt;&lt;P&gt;     for all entres in t_fagltemp&lt;/P&gt;&lt;P&gt;     where bukrs = t_fagltemp-bukrs&lt;/P&gt;&lt;P&gt;       and saknr = t_fagltemp-racct.&lt;/P&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;P&gt;Based on the information obtained above, the data can be formatted according to the requirement into a single internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 14:22:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020280#M714009</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T14:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning: Retrieving data from 4 tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020281#M714010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;JOINs usually perform better than FOR ALL ENTRIES, contrary to what many believe. Please see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better"&amp;gt;JOINS vs. FOR ALL ENTRIES - Which Performs Better?&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT a~belnr a~bldat a~budat a~monat a~usnam a~bktxt a~waers
       b~racct b~wsl   b~drcrk b~buzei c~txt50 d~altkt
  INTO TABLE gt_all
  FROM bkpf AS a
    INNER JOIN faglflexa AS b
      ON a~belnr = b~docnr
    INNER JOIN skat AS c
      ON b~racct = c~saknr
    INNER JOIN skb1 AS d
      ON  d~bukrs = a~bukrs     "&amp;lt;== Include company code
      AND d~saknr = c~saknr
  WHERE a~bukrs = p_bukrs  AND
        a~bstat = ' '      AND  "&amp;lt;== Any others you want too
        a~budat IN s_budat AND
        a~gjahr = p_gjahr  AND
        a~blart = p_blart  AND
        a~monat IN s_monat AND
        b~ryear = p_gjahr  AND
        b~rbukrs = p_bukrs AND
        b~rldnr = '0L'     AND
        b~rvers = '001'    AND
        c~spras = sy-langu AND  "&amp;lt;== Language
        c~ktopl = '????'.       "&amp;lt;== Chart of accounts&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>Mon, 12 Nov 2007 14:42:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning-retrieving-data-from-4-tables/m-p/3020281#M714010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T14:42:33Z</dc:date>
    </item>
  </channel>
</rss>

