2013 Dec 05 3:42 AM
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.
2013 Dec 05 4:07 AM
Your select query looks perfect..check some other part of your report program & try to avoid using 'corresponding fields of table'....
2013 Dec 05 4:08 AM
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
2013 Dec 05 4:10 AM
HI,
Also have a look at these SAP notes.
191492,187906,185530.
Regards,
Josh
2013 Dec 05 4:16 AM
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
2013 Dec 05 4:21 AM
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.
2013 Dec 05 4:23 AM
Hi,
I suggest to follow below strategy;
2013 Dec 05 4:26 AM
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
2013 Dec 05 4:34 AM
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~mblnr | eq p_mblnr | |
and mkpf~mjahr | in s_mjahr. |
2013 Dec 05 9:27 AM
Hy,
I Suggest You To Select Indexer Variable first in query.
Thanks
PRAVEEN,,