<?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: MSEG Performance Issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682312#M1449829</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I may be that the view COVP which joins COEP and COBK may be better suited to your purposes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The number of records in a table is essentially not relevant to performance. What matters is how you access the records. Table COEP is the main table for CO related line items. And can be accessed quickly using the index COEP~1 (LEDNR and OBJNR). The LEDNR is always "00' (you'll want to verify this in your system) and the OBJNR is made up of concatenating 'KS', the co area and the cost center. It can be made up of other things as well, but this should work in your case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem will in relating the CO line item back to the material document that you want, and I am not sure this will be possible here. It may depend on the configuration in your system. You can select some records from COEP and see if you can find a relationship between the CO document and the material document - maybe the reference document REFBN in COBK. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Mar 2010 14:06:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-15T14:06:39Z</dc:date>
    <item>
      <title>MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682296#M1449813</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;&lt;/P&gt;&lt;P&gt;I am trying to build up a table containing &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MKPF-BUDAT and a number of fields from MSEG....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The user wants to select a range of 12 months worth of data.  This is running extremely slow, the code is shown below:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Get all mat docs headers for date
* wa_firsdat wa_lasdat selected from user (calculated from function
  SELECT b~mblnr b~mjahr a~budat b~zeile b~bwart b~matnr
                                 b~werks b~menge b~meins b~kostl
    FROM mkpf AS a
   INNER JOIN mseg AS b
      ON a~mblnr = b~mblnr
     AND a~mjahr = b~mjahr
    INTO CORRESPONDING FIELDS OF TABLE wt_mseg
   WHERE a~budat BETWEEN wa_firdat AND wa_lasdat
     AND a~mblnr BETWEEN '4900000000' AND '5999999999'
     AND b~zeile BETWEEN 1 AND 9999
     AND b~bwart = wa_move.

  IF NOT p_werks IS INITIAL.                "Delete invalid plants
    DELETE wt_mseg WHERE NOT werks = p_werks.
  ENDIF.

  IF NOT s_kostl IS INITIAL.                "Delete invalid CostCentres
    DELETE wt_mseg WHERE NOT kostl IN s_kostl.
  ENDIF.

  IF wt_mseg IS INITIAL.
    MESSAGE e999 WITH 'No values for this selection'.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way I can improve the performance of this code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 10:59:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682296#M1449813</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-11T10:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682297#M1449814</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;Define the table same way as you retrieve respective fields like:&lt;/P&gt;&lt;P&gt;Data : begin of wt_mseg occurs 0,&lt;/P&gt;&lt;P&gt;       mblnr    TYPE MBLNR,&lt;/P&gt;&lt;P&gt;       mjahr    type MJAHR,&lt;/P&gt;&lt;P&gt;       budat    type BUDAT,&lt;/P&gt;&lt;P&gt;       zeile    type MBLPO,&lt;/P&gt;&lt;P&gt;       bwart    type bwart,&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;       menge    type MENGE_D,&lt;/P&gt;&lt;P&gt;       meins    type MEINS,&lt;/P&gt;&lt;P&gt;       kostl    type KOSTL,&lt;/P&gt;&lt;P&gt;  end of wt_mseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp; Write the Select statement in following manner:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT b&lt;SUB&gt;mblnr b&lt;/SUB&gt;mjahr a&lt;SUB&gt;budat b&lt;/SUB&gt;zeile b&lt;SUB&gt;bwart b&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;                                 b&lt;SUB&gt;werks b&lt;/SUB&gt;menge b&lt;SUB&gt;meins b&lt;/SUB&gt;kostl&lt;/P&gt;&lt;P&gt;    FROM mkpf AS a&lt;/P&gt;&lt;P&gt;   INNER JOIN mseg AS b&lt;/P&gt;&lt;P&gt;      ON a&lt;SUB&gt;mblnr = b&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;     AND a&lt;SUB&gt;mjahr = b&lt;/SUB&gt;mjahr&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;INTO TABLE wt_mseg&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   WHERE a~mblnr BETWEEN '4900000000' AND '5999999999'&lt;/P&gt;&lt;P&gt;     AND a~budat BETWEEN wa_firdat AND wa_lasdat&lt;/P&gt;&lt;P&gt;     AND b~zeile BETWEEN 1 AND 9999&lt;/P&gt;&lt;P&gt;     AND b~bwart = wa_move&lt;/P&gt;&lt;P&gt;     AND b~werks = p_werks&lt;/P&gt;&lt;P&gt;     AND b~KOSTL in s_KOSTL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If wt_mseg is initial.&lt;/P&gt;&lt;P&gt;messgae&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;Ni3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ni3 on Mar 11, 2010 5:30 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ni3 on Mar 11, 2010 5:34 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 11:54:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682297#M1449814</guid>
      <dc:creator>former_member434229</dc:creator>
      <dc:date>2010-03-11T11:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682298#M1449815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;since KOSTL is a requirement for the SELECT, I would first see if you can work table COEP into it using the cost center in the object number. This will add to the programming effort, but may speed up what you are trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 14:36:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682298#M1449815</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-11T14:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682299#M1449816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks guys - i will have a look at that - i think i am going to be stumped as the business wants to bring back such a large date range....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you definitely think adding plant and cost center to the select query is better than deleting from the table afterwards?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: SpLuFF on Mar 11, 2010 3:44 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 14:38:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682299#M1449816</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-11T14:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682300#M1449817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If s_kostl is small, that should reduce the amount of data returned significantly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 14:49:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682300#M1449817</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-11T14:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682301#M1449818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i definitely know that only 1 plant will be selected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 14:53:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682301#M1449818</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-11T14:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682302#M1449819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;KOSTL is the cost center, not the plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 15:07:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682302#M1449819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-11T15:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682303#M1449820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes i know that &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;  just the first answer suggested moving plant to the select query and i know that will definitely only be one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 15:08:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682303#M1449820</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-11T15:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682304#M1449821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have a solution (yet) to speed this up, but it does not make sense to read data from the database only to delete it afterwards from memory. Include both select options in your select query as suggested by "Ni3" already.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 15:14:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682304#M1449821</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2010-03-11T15:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682305#M1449822</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 can be really tough to optimize mkpf / mseg joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But lets start with the general join optimization approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE a~mblnr BETWEEN '4900000000' AND '5999999999'&lt;/P&gt;&lt;P&gt;AND a~budat BETWEEN wa_firdat AND wa_lasdat&lt;/P&gt;&lt;P&gt;AND b~zeile BETWEEN 1 AND 9999&lt;/P&gt;&lt;P&gt;AND b~bwart = wa_move&lt;/P&gt;&lt;P&gt;AND b~werks = p_werks&lt;/P&gt;&lt;P&gt;AND b~KOSTL in s_KOSTL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check in SE16 with the where conditions given for each table what&lt;/P&gt;&lt;P&gt;the result set is. Check (ST05 execution plan) if the optimizer starts with the table that has&lt;/P&gt;&lt;P&gt;the smaller result set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is not the case you can work on that to convince the optimizer to&lt;/P&gt;&lt;P&gt;choose the smaller resultset first. This is basically done with providing more&lt;/P&gt;&lt;P&gt;information to the optimzer or use a hint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the optimizer starts already with the smaller result set it starts to&lt;/P&gt;&lt;P&gt;get really difficult.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But first check if you already start with the right table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 20:25:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682305#M1449822</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2010-03-11T20:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682306#M1449823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Definitely follow Hermann's suggestion to check the result sets for each table individually via SE16(n). Count the number of entries returned and compare it against the total number of entries. Do a SQL trace on your join and see what execution plan is picked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Hermann mentioned, you want to make sure that a proper join type is selected (e.g. on Oracle nested loop, hash join, sort merge join). Also, if you're returning a large percentage of the table it is sometimes beneficial to skip any index access and do a full table scan instead (ideally the database makes the right choice, but it doesn't hurt to experiment). Use database hints to push the database to choose other execution plans and compare the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPKF should have primary key and at least the secondary index on BUDAT/MBLNR. I'd toy also with the conditions and try omitting some (e.g. does the database choose different execution plan if you omit the catch-all condition on ZEILE). Since you want one year of data, I'd try adding a condition on MJAHR (derive via program from BUDAT condition); if the primary key on MKPF is beneficial and used then you'd skip some entries by specifying this. So this seems promising to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked the (default) indexes on MSEG in ECC6.0, but there seems to be nothing that supports your MSEG conditions well (might be different in your system). So I'd assume driving table should be MKPF and then data is read for those from MSEG - oops, did I really make such a stupid statement without testing it?! .... &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, harald&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s.: It's kind of surprising how often the business wants to see those huge datasets. Usually you'd expect that some aggregation is necessary, because who can look at those tons of rows. So this sounds more like the kind of query that ideally is done in BW/BI if present...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Mar 2010 01:15:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682306#M1449823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-12T01:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682307#M1449824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tested using a smaller data set and get the following:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the original SQL:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T_01                                                          RANGE CONDITION FOR KEY                     1197278&lt;/P&gt;&lt;P&gt;                               MANDT                               (USED KEY COLUMN) &lt;/P&gt;&lt;P&gt;                               MBLNR                               (USED KEY COLUMN)  &lt;/P&gt;&lt;P&gt;                           &lt;/P&gt;&lt;P&gt;T_00                                                          JOIN VIA MULTIPLE KEY COLUMNS  39200&lt;/P&gt;&lt;P&gt;                               MANDT                               (USED KEY COLUMN)  &lt;/P&gt;&lt;P&gt;                              MBLNR                               (USED KEY COLUMN)  &lt;/P&gt;&lt;P&gt;                              MJAHR                               (USED KEY COLUMN) &lt;/P&gt;&lt;P&gt;                        NO TEMPORARY RESULTS CREATED &lt;/P&gt;&lt;P&gt;                          RESULT IS COPIED   , COSTVALUE IS      1198155&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the modified with the plant and cost center:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T_00       MKPF~BUD                       RANGE CONDITION FOR INDEX                     39200&lt;/P&gt;&lt;P&gt;                                                              ONLY INDEX ACCESSED  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                               MANDT                               (USED INDEX COLUMN)  &lt;/P&gt;&lt;P&gt;                               BUDAT                               (USED INDEX COLUMN)  &lt;/P&gt;&lt;P&gt;                               MBLNR                               (USED INDEX COLUMN)  &lt;/P&gt;&lt;P&gt;                               MANDT                               (USED KEY COLUMN)  &lt;/P&gt;&lt;P&gt;                               MBLNR                               (USED KEY COLUMN)    &lt;/P&gt;&lt;P&gt;                         &lt;/P&gt;&lt;P&gt;T_01                                              JOIN VIA RANGE OF MULTIPLE KEY COLUMNS  1197278&lt;/P&gt;&lt;P&gt;                               MANDT                               (USED KEY COLUMN)    &lt;/P&gt;&lt;P&gt;                               MBLNR                               (USED KEY COLUMN)   &lt;/P&gt;&lt;P&gt;                               MJAHR                               (USED KEY COLUMN)   &lt;/P&gt;&lt;P&gt;                           NO TEMPORARY RESULTS CREATED  &lt;/P&gt;&lt;P&gt;                SHOW                                               RESULT IS COPIED   , COSTVALUE IS  638&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also in prod I get the following counts:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No of entries:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zeile(1 - 9999) = 24,185,120&lt;/P&gt;&lt;P&gt;bwart(551)      = 90,242&lt;/P&gt;&lt;P&gt;werks(1500)     = 18,860,804&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Mar 2010 10:59:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682307#M1449824</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-12T10:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682308#M1449825</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;please post the number of entries for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MKPF:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE a~mblnr BETWEEN '4900000000' AND '5999999999'&lt;/P&gt;&lt;P&gt;AND a~budat BETWEEN wa_firdat AND wa_lasdat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and for MSGE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;AND b~zeile BETWEEN 1 AND 9999&lt;/P&gt;&lt;P&gt;AND b~bwart = wa_move&lt;/P&gt;&lt;P&gt;AND b~werks = p_werks&lt;/P&gt;&lt;P&gt;AND b~KOSTL in s_KOSTL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;not for the single fields but for the combination.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at this plan:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T_00 MKPF~BUD RANGE CONDITION FOR INDEX 39200&lt;/P&gt;&lt;P&gt;ONLY INDEX ACCESSED &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MANDT (USED INDEX COLUMN) &lt;/P&gt;&lt;P&gt;BUDAT (USED INDEX COLUMN) &lt;/P&gt;&lt;P&gt;MBLNR (USED INDEX COLUMN) &lt;/P&gt;&lt;P&gt;MANDT (USED KEY COLUMN) &lt;/P&gt;&lt;P&gt;MBLNR (USED KEY COLUMN) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T_01 JOIN VIA RANGE OF MULTIPLE KEY COLUMNS 1197278&lt;/P&gt;&lt;P&gt;MANDT (USED KEY COLUMN) &lt;/P&gt;&lt;P&gt;MBLNR (USED KEY COLUMN) &lt;/P&gt;&lt;P&gt;MJAHR (USED KEY COLUMN) &lt;/P&gt;&lt;P&gt;NO TEMPORARY RESULTS CREATED &lt;/P&gt;&lt;P&gt;SHOW RESULT IS COPIED , COSTVALUE IS 638&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we start on MKPF using the BUDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is the number of rows in MKPF for this condition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE a~mblnr BETWEEN '4900000000' AND '5999999999'&lt;/P&gt;&lt;P&gt;AND a~budat BETWEEN wa_firdat AND wa_lasdat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;less than the number of rows in MSEG for this condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;AND b~zeile BETWEEN 1 AND 9999&lt;/P&gt;&lt;P&gt;AND b~bwart = wa_move&lt;/P&gt;&lt;P&gt;AND b~werks = p_werks&lt;/P&gt;&lt;P&gt;AND b~KOSTL in s_KOSTL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in general: how much rows are selected in total and how long does it take?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Mar 2010 14:59:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682308#M1449825</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2010-03-12T14:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682309#M1449826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MKPF:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE a~mblnr BETWEEN '4900000000' AND '5999999999'&lt;/P&gt;&lt;P&gt;AND a~budat BETWEEN wa_firdat AND wa_lasdat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This takes 5 minutes and returns 607954 records&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and for MSGE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;AND b~zeile BETWEEN 1 AND 9999&lt;/P&gt;&lt;P&gt;AND b~bwart = wa_move&lt;/P&gt;&lt;P&gt;AND b~werks = p_werks&lt;/P&gt;&lt;P&gt;AND b~KOSTL in s_KOSTL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This runs for 30minutes and times out so dont have record count&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 09:10:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682309#M1449826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T09:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682310#M1449827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I said before, have a look at COEP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 13:13:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682310#M1449827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T13:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682311#M1449828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was just replying to the questions before...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had a look at COEP but that table is huge with millions of records in it.  I cant see how that would speed up the query.  Can you please explain?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnx&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 13:42:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682311#M1449828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T13:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: MSEG Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682312#M1449829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I may be that the view COVP which joins COEP and COBK may be better suited to your purposes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The number of records in a table is essentially not relevant to performance. What matters is how you access the records. Table COEP is the main table for CO related line items. And can be accessed quickly using the index COEP~1 (LEDNR and OBJNR). The LEDNR is always "00' (you'll want to verify this in your system) and the OBJNR is made up of concatenating 'KS', the co area and the cost center. It can be made up of other things as well, but this should work in your case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem will in relating the CO line item back to the material document that you want, and I am not sure this will be possible here. It may depend on the configuration in your system. You can select some records from COEP and see if you can find a relationship between the CO document and the material document - maybe the reference document REFBN in COBK. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Mar 2010 14:06:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mseg-performance-issue/m-p/6682312#M1449829</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-15T14:06:39Z</dc:date>
    </item>
  </channel>
</rss>

