<?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 mchb performance improvement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990417#M1342427</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please tell me how can I improve the performance because it is taking much time while fetching from mchb table.&lt;/P&gt;&lt;P&gt;(note:There are no indexes to mchb table)&lt;/P&gt;&lt;P&gt;=====================&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1 st part&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF tt_mchb,&lt;/P&gt;&lt;P&gt;          matnr TYPE matnr,     &lt;/P&gt;&lt;P&gt;          werks TYPE werks_d,   &lt;/P&gt;&lt;P&gt;          lgort TYPE LGORT_D,   &lt;/P&gt;&lt;P&gt;          charg TYPE charg_d,   &lt;/P&gt;&lt;P&gt;          clabs TYPE labst,     &lt;/P&gt;&lt;P&gt;          cinsm TYPE insme,    &lt;/P&gt;&lt;P&gt;          cspem TYPE speme,     &lt;/P&gt;&lt;P&gt;          KZICL TYPE KZILL,     &lt;/P&gt;&lt;P&gt;        END OF tt_mchb.&lt;/P&gt;&lt;P&gt;Data :     i_mchb       TYPE TABLE OF tt_mchb.&lt;/P&gt;&lt;P&gt;    SELECT matnr   &lt;/P&gt;&lt;P&gt;           werks   &lt;/P&gt;&lt;P&gt;           lgort   &lt;/P&gt;&lt;P&gt;           charg   &lt;/P&gt;&lt;P&gt;           clabs   &lt;/P&gt;&lt;P&gt;           cinsm   &lt;/P&gt;&lt;P&gt;           cspem   &lt;/P&gt;&lt;P&gt;           kzicl   &lt;/P&gt;&lt;P&gt;      FROM mchb&lt;/P&gt;&lt;P&gt;      INTO TABLE i_mchb&lt;/P&gt;&lt;P&gt;     WHERE matnr IN s_matnr&lt;/P&gt;&lt;P&gt;       AND werks IN s_plant&lt;/P&gt;&lt;P&gt;       AND charg IN s_charg&lt;/P&gt;&lt;P&gt;       AND ersda IN s_date  &lt;/P&gt;&lt;P&gt;              .&lt;/P&gt;&lt;P&gt;==================&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2nd part :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FORM output_itab2_mtart .&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;lwa_mch1&amp;gt;      TYPE tt_mch1,&lt;/P&gt;&lt;P&gt;&amp;lt;lwa_makt_maktx&amp;gt; TYPE tt_makt_maktx,&lt;/P&gt;&lt;P&gt;&amp;lt;lwa_mvke&amp;gt;       TYPE tt_mvke,&lt;/P&gt;&lt;P&gt;&amp;lt;lwa_mara&amp;gt;       TYPE tt_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_mcha INTO wa_mcha.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    READ TABLE i_mch1 WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;               charg = wa_mcha-charg&lt;/P&gt;&lt;P&gt;               ASSIGNING &amp;lt;lwa_mch1&amp;gt;.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      READ TABLE i_mara WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;                        ASSIGNING &amp;lt;lwa_mara&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        READ TABLE i_mvke WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;                ASSIGNING &amp;lt;lwa_mvke&amp;gt;.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          wa_final_itab-mvgr1 = &amp;lt;lwa_mvke&amp;gt;-mvgr1.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;        wa_final_itab-matnr = wa_mcha-matnr.&lt;/P&gt;&lt;P&gt;        wa_final_itab-werks = wa_mcha-werks.&lt;/P&gt;&lt;P&gt;        wa_final_itab-lifnr = wa_mcha-lifnr.&lt;/P&gt;&lt;P&gt;        wa_final_itab-charg = &amp;lt;lwa_mch1&amp;gt;-charg.&lt;/P&gt;&lt;P&gt;        wa_final_itab-lvorm = &amp;lt;lwa_mch1&amp;gt;-lvorm.&lt;/P&gt;&lt;P&gt;        wa_final_itab-zustd = &amp;lt;lwa_mch1&amp;gt;-zustd.&lt;/P&gt;&lt;P&gt;        wa_final_itab-licha = &amp;lt;lwa_mch1&amp;gt;-licha.&lt;/P&gt;&lt;P&gt;        wa_final_itab-vfdat = &amp;lt;lwa_mch1&amp;gt;-vfdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         READ TABLE i_makt_maktx  WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;                   ASSIGNING &amp;lt;lwa_makt_maktx&amp;gt;.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          wa_final_itab-maktx = &amp;lt;lwa_makt_maktx&amp;gt;-maktx.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND wa_final_itab TO i_final_itab.&lt;/P&gt;&lt;P&gt;        CLEAR : wa_final_itab, wa_mcha, wa_stext.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in ADV.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Aug 2009 06:08:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-18T06:08:27Z</dc:date>
    <item>
      <title>select mchb performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990417#M1342427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please tell me how can I improve the performance because it is taking much time while fetching from mchb table.&lt;/P&gt;&lt;P&gt;(note:There are no indexes to mchb table)&lt;/P&gt;&lt;P&gt;=====================&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1 st part&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF tt_mchb,&lt;/P&gt;&lt;P&gt;          matnr TYPE matnr,     &lt;/P&gt;&lt;P&gt;          werks TYPE werks_d,   &lt;/P&gt;&lt;P&gt;          lgort TYPE LGORT_D,   &lt;/P&gt;&lt;P&gt;          charg TYPE charg_d,   &lt;/P&gt;&lt;P&gt;          clabs TYPE labst,     &lt;/P&gt;&lt;P&gt;          cinsm TYPE insme,    &lt;/P&gt;&lt;P&gt;          cspem TYPE speme,     &lt;/P&gt;&lt;P&gt;          KZICL TYPE KZILL,     &lt;/P&gt;&lt;P&gt;        END OF tt_mchb.&lt;/P&gt;&lt;P&gt;Data :     i_mchb       TYPE TABLE OF tt_mchb.&lt;/P&gt;&lt;P&gt;    SELECT matnr   &lt;/P&gt;&lt;P&gt;           werks   &lt;/P&gt;&lt;P&gt;           lgort   &lt;/P&gt;&lt;P&gt;           charg   &lt;/P&gt;&lt;P&gt;           clabs   &lt;/P&gt;&lt;P&gt;           cinsm   &lt;/P&gt;&lt;P&gt;           cspem   &lt;/P&gt;&lt;P&gt;           kzicl   &lt;/P&gt;&lt;P&gt;      FROM mchb&lt;/P&gt;&lt;P&gt;      INTO TABLE i_mchb&lt;/P&gt;&lt;P&gt;     WHERE matnr IN s_matnr&lt;/P&gt;&lt;P&gt;       AND werks IN s_plant&lt;/P&gt;&lt;P&gt;       AND charg IN s_charg&lt;/P&gt;&lt;P&gt;       AND ersda IN s_date  &lt;/P&gt;&lt;P&gt;              .&lt;/P&gt;&lt;P&gt;==================&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2nd part :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FORM output_itab2_mtart .&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;lwa_mch1&amp;gt;      TYPE tt_mch1,&lt;/P&gt;&lt;P&gt;&amp;lt;lwa_makt_maktx&amp;gt; TYPE tt_makt_maktx,&lt;/P&gt;&lt;P&gt;&amp;lt;lwa_mvke&amp;gt;       TYPE tt_mvke,&lt;/P&gt;&lt;P&gt;&amp;lt;lwa_mara&amp;gt;       TYPE tt_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_mcha INTO wa_mcha.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    READ TABLE i_mch1 WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;               charg = wa_mcha-charg&lt;/P&gt;&lt;P&gt;               ASSIGNING &amp;lt;lwa_mch1&amp;gt;.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      READ TABLE i_mara WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;                        ASSIGNING &amp;lt;lwa_mara&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        READ TABLE i_mvke WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;                ASSIGNING &amp;lt;lwa_mvke&amp;gt;.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          wa_final_itab-mvgr1 = &amp;lt;lwa_mvke&amp;gt;-mvgr1.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;        wa_final_itab-matnr = wa_mcha-matnr.&lt;/P&gt;&lt;P&gt;        wa_final_itab-werks = wa_mcha-werks.&lt;/P&gt;&lt;P&gt;        wa_final_itab-lifnr = wa_mcha-lifnr.&lt;/P&gt;&lt;P&gt;        wa_final_itab-charg = &amp;lt;lwa_mch1&amp;gt;-charg.&lt;/P&gt;&lt;P&gt;        wa_final_itab-lvorm = &amp;lt;lwa_mch1&amp;gt;-lvorm.&lt;/P&gt;&lt;P&gt;        wa_final_itab-zustd = &amp;lt;lwa_mch1&amp;gt;-zustd.&lt;/P&gt;&lt;P&gt;        wa_final_itab-licha = &amp;lt;lwa_mch1&amp;gt;-licha.&lt;/P&gt;&lt;P&gt;        wa_final_itab-vfdat = &amp;lt;lwa_mch1&amp;gt;-vfdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         READ TABLE i_makt_maktx  WITH KEY matnr = wa_mcha-matnr&lt;/P&gt;&lt;P&gt;                   ASSIGNING &amp;lt;lwa_makt_maktx&amp;gt;.&lt;/P&gt;&lt;P&gt;        IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          wa_final_itab-maktx = &amp;lt;lwa_makt_maktx&amp;gt;-maktx.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND wa_final_itab TO i_final_itab.&lt;/P&gt;&lt;P&gt;        CLEAR : wa_final_itab, wa_mcha, wa_stext.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in ADV.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 06:08:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990417#M1342427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T06:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: select mchb performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990418#M1342428</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;As you mentioned that there are no Index created on that table, it would really improve the performance if you can create an index with the following on mind. Have a look at the following link: &lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/aa/47349d0f1c11d295380000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/aa/47349d0f1c11d295380000e8353423/content.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can have a look at the performance time by using the SQL Trace (ST05). If you still find that the database access is not improved you can consider the use of Native SQL statement to access the database. But there are some drawbacks to it. &lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/aa/4734a00f1c11d295380000e8353423/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/aa/4734a00f1c11d295380000e8353423/frameset.htm&lt;/A&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From you code, it's better if you can use a internal table of field symbol instead of a standard internal table. Also, before calling the select statement, check all the select option that are part of it. This will keep the amount of data to be transfered very less and will also enhance the where clause thus will improve the search criteria. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the following link for a complete overview of the Performance Factors of ABAP Code: &lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/aa/4734a00f1c11d295380000e8353423/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/aa/4734a00f1c11d295380000e8353423/frameset.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Samantak.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 08:51:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990418#M1342428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T08:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: select mchb performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990419#M1342429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you selecting the MCHB by it's key fields.. the select should fetch records quickly.... In 2nd part of your code whenever you are reading internal table sort them and use Binary search addition. It will improve runtime performance of the program.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

LOOP AT i_mcha INTO wa_mcha.

READ TABLE i_mch1 WITH KEY matnr = wa_mcha-matnr " Sort I_MCH1 and add Binary search
charg = wa_mcha-charg
ASSIGNING &amp;lt;lwa_mch1&amp;gt;.
IF sy-subrc = 0.

READ TABLE i_mara WITH KEY matnr = wa_mcha-matnr  " Sort I_MARA and add Binary search
ASSIGNING &amp;lt;lwa_mara&amp;gt; .

IF sy-subrc = 0.
READ TABLE i_mvke WITH KEY matnr = wa_mcha-matnr  " Sort I_MVKE and add Binary search
ASSIGNING &amp;lt;lwa_mvke&amp;gt;.
IF sy-subrc = 0.
wa_final_itab-mvgr1 = &amp;lt;lwa_mvke&amp;gt;-mvgr1.
ENDIF.
wa_final_itab-matnr = wa_mcha-matnr.
wa_final_itab-werks = wa_mcha-werks.
wa_final_itab-lifnr = wa_mcha-lifnr.
wa_final_itab-charg = &amp;lt;lwa_mch1&amp;gt;-charg.
wa_final_itab-lvorm = &amp;lt;lwa_mch1&amp;gt;-lvorm.
wa_final_itab-zustd = &amp;lt;lwa_mch1&amp;gt;-zustd.
wa_final_itab-licha = &amp;lt;lwa_mch1&amp;gt;-licha.
wa_final_itab-vfdat = &amp;lt;lwa_mch1&amp;gt;-vfdat.

READ TABLE i_makt_maktx WITH KEY matnr = wa_mcha-matnr " Sort I_MAKT and add Binary search
ASSIGNING &amp;lt;lwa_makt_maktx&amp;gt;.
IF sy-subrc = 0.
wa_final_itab-maktx = &amp;lt;lwa_makt_maktx&amp;gt;-maktx.
ENDIF.

APPEND wa_final_itab TO i_final_itab.
CLEAR : wa_final_itab, wa_mcha, wa_stext.
ENDIF.
ENDIF.
ENDLOOP

.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 14:23:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990419#M1342429</guid>
      <dc:creator>SG141</dc:creator>
      <dc:date>2009-08-18T14:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: select mchb performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990420#M1342430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;The primary key of the table is &lt;/P&gt;&lt;P&gt;MATNR&lt;/P&gt;&lt;P&gt;WERKS&lt;/P&gt;&lt;P&gt;LGORT&lt;/P&gt;&lt;P&gt;CHARG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In you select query &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;SELECT matnr &lt;/P&gt;&lt;P&gt;werks &lt;/P&gt;&lt;P&gt;lgort &lt;/P&gt;&lt;P&gt;charg &lt;/P&gt;&lt;P&gt;clabs &lt;/P&gt;&lt;P&gt;cinsm &lt;/P&gt;&lt;P&gt;cspem &lt;/P&gt;&lt;P&gt;kzicl &lt;/P&gt;&lt;P&gt;FROM mchb&lt;/P&gt;&lt;P&gt;INTO TABLE i_mchb&lt;/P&gt;&lt;P&gt;WHERE matnr IN s_matnr&lt;/P&gt;&lt;P&gt;AND werks IN s_plant&lt;/P&gt;&lt;P&gt;AND charg IN s_charg&lt;/P&gt;&lt;P&gt;AND ersda IN s_date.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are passing only part of the key; so the selection will take time.&lt;/P&gt;&lt;P&gt;Pass the entire primary key fields in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Incase you do not have LGORT on your selection screen; then create a range table and get all the storage location values from table T001L into this range table and use the same in the select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In you second perform FORM output_itab2_mtart;&lt;/P&gt;&lt;P&gt;You are reading on the internal tables  i_mch1,  i_mvke, i_mara and i_makt_maktx.&lt;/P&gt;&lt;P&gt;Use binary search in these read statements but efore using binary search make sure the tables are sorted by the fields which u specify in the with key clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 15:56:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990420#M1342430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T15:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: select mchb performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990421#M1342431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a good reminder that the PK of a table is also an index - people forget that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are passing only part of the key; so the selection will take time.&lt;/P&gt;&lt;P&gt;Pass the entire primary key fields in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case you do not have LGORT on your selection screen; then create a range table and get all the storage location values from table T001L into this range table and use the same in the select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That will not help. Including all possible values gives the same index selectivity as supplying nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matnr and Werks are the leading fields of the PK, so the number of filtered entries here are what drive the selectivity of the PK based fetch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How many records are being returned? How did you confirm that it is the original fetch that is taking a long time and not Part 2?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The need for your other i_* tables is hard to determine. You may be better served to join on all of them in a single fetch, rather than fetch all records from each table yourself and then have your ABAP perform the join. This is potentially bad for two reasons:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. You fetch more data from the other tables than you need. Not sure if this is the case, you may be using the same filters.&lt;/P&gt;&lt;P&gt;2. As other replies have suggested you need to know how to set up the internal tables to perform this logic efficiently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DB layer is excellent for doing this for you. You may have your other i_* tables for good reason, but if not, consider using a single select with joins.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2009 00:26:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990421#M1342431</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-21T00:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: select mchb performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990422#M1342432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is any of the select-option mandatory? If all are optional and all are blank, the select will fetch entire data from table.&lt;/P&gt;&lt;P&gt;Please make sure that the any of the primary key among the fields in where condition is populated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Aug 2009 13:31:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-mchb-performance-improvement/m-p/5990422#M1342432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-23T13:31:57Z</dc:date>
    </item>
  </channel>
</rss>

