Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Performance issue

Former Member
0 Kudos
254

while excuting my report it takes long time.

in sm51 it shows sequential read on mseg.what i have to do.this is how i am fetching data from mseg,

select mblnr

            mjahr

            zeile

            bwart

            matnr

            menge

            meins

            shkzg

            werks

            dmbtr

            kzstr

            ebeln

            bwtar

            xauto

            aufnr

       into corresponding fields of table git_mseg_h

       from mseg

       for all entries in git_mkpf_h

       where mblnr = git_mkpf_h-mblnr and

             mjahr = git_mkpf_h-mjahr and

             zeile in s_zeile.

9 REPLIES 9

Former Member
0 Kudos
182

Your select query looks perfect..check some other part of your report program & try to avoid using 'corresponding fields of table'....

JJosh
Active Participant
0 Kudos
182

Hi,

Avoid into corresponding fields of table, Instead use

IF GIT_MKPG_H[] IS NOT INITIAL.

SELECT <FIELDS>

            INTO TABLE GIT_MSEG_H

            etc etc . . . .

Fields should be fetched in the same order as mentioned in table (Also order should be same in TYPES).

Regards,

Josh

JJosh
Active Participant
0 Kudos
182

HI,

Also have a look at these SAP notes.


191492,187906,185530.

Regards,

Josh

Former Member
0 Kudos
182

Please try the following for improving performance

Create a table containing the necessary fields from MKPF and MSEG combined and fetch the respective fields using the following options

(1)Table/View WB2_V_MKPF_MSEG2 :  MKPF and MSEG are created as header and line item tables and there is a  which can be used.

(2) Update your select Statement

      select required fields

       into table git_XXXX

       from WB2_V_MKPF_MSEG2

       where zeile in s_zeile.

    OR continue using your existing select statement with the new internal table with required fields

       so that  "into corresponding fields of table" can be avoided.Since the structure is large (MSEG 

       has approx 250 + fields ),I assume that performace can be improved by this

Recommendation

The select Query will perform faster if you are passing the key fields.Check if there can be a mandatory parameter like MJAHR which considerably reduces the load and improves performances

Former Member
0 Kudos
182

Hi,

Define the internal table( git_mseg_h) with required fields after that use INTO Table git_mseg_h instead of into corresponding fields of table.

Former Member
0 Kudos
182

Hi,

I  suggest to follow below strategy;

  • When using the SELECT statement, study the key and always provide as much as key as possible  in condition.
  • . Use PACKAGE SIZE in select query i.e fetching of data in set of packages .

  • .Even if above method doesn't lead to improvement then create Secondary index for the table..

Former Member
0 Kudos
182

Hi,

I would like to add a point.

As it has been told a lot of occasion in the scn to use joins instead of for all entries.

So better use a join. That may increase your performance.

Regards

Former Member
0 Kudos
182

Hi,

Use Joins instead of for all entries. it works better!

  select   mseg~mblnr mseg~mjahr mseg~zeile
           mkpf~xblnr mkpf~budat
           mseg~matnr mseg~ebeln mseg~ebelp
           mseg~lifnr mseg~zz_lifnr
           into table gt_material  "
           from mkpf inner join mseg
           on mkpf~mblnr eq mseg~mblnr
              and mkpf~mjahr eq mseg~mjahr
     where mkpf~mblnreq p_mblnr
     and   mkpf~mjahrin s_mjahr.

praveenboss
Participant
0 Kudos
182

Hy,

  I Suggest You To Select Indexer Variable first in  query.

Thanks

PRAVEEN,,