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: 

MSEG Performance Issue

Former Member
0 Kudos

Hi All,

I have to access data from MKPF & MSEG tables.

I first take the data from MKPF(give BUDAT in the where condition) in an internal table.

Then i loop through that internal table and select data from MSEG. I am giving all the primary keys in the where clause for MSEG. It has to extract just 25 records, but when I see in SM50 it shows sequential read for MSEG, and also takes lot of time(more than 1200 secs).

Plz suggest me a sol...how do I fix this problem

Thanks & regards

Niyati

8 REPLIES 8

Former Member
0 Kudos

create a secondary index for MSEG and MKPF also.

if i_mkpf[] is not initial.

select * from mseg into corresponding fields of imseg

for all entreis in i_mkpf

where mblnr = i_mkpf-mblnr

mjahr = i_mkpf-mjahr.

endif.

Regards

Prabhu

Former Member
0 Kudos

Hi

Select inside a LOOP-ENDLOOP can cause performance bottleneck.

try to use FOR ALL ENTRIES. delete the duplicate entries before that:

try this:

sort it_mkpf by mblnr mjahr.  " chk this
if i_mkpf[] is not initial.
 select mblnr mjahr zeile 
    into table it_mseg
    from mseg
    for all entries in it_mkpf
    where mblnr = it_mkpf-mblnr and
              mjahr = it_mkpf-mjahr.
endif.

**reward if helpful

regards,

madhu

Former Member
0 Kudos

hi,

use binary search with read statement.and create secondary indexes for mseg fields.

thanks & regards,

j.prakash.

Former Member
0 Kudos

INSTEAD OF USING LOOP USE SELECT ..........FOR ALL ENTRIES STATEMENT .

EX.

SELECT <SELECTION LIST>

FROM MSEG

INTO TABLE I_MSEG

FOR ALL ENTRIES IN I_MKPF

WHERE MBLNR EQ I_MKPF-MBLNR

AND BUDAT EQ I_MKPF-BUDAT.

I THINK THIS WOULD SOLVE UR PROBLEM.

VijayasekarK
Active Participant
0 Kudos

Hi ,

Check this sap note for custom developments in MM module...

191492 Performance: Customer developments in MM/WM

Regards,

K Vijayasekar

Former Member
0 Kudos

Please use below following Option to get good Performance

1. Use For all entries if possible

2. use Read Statement with binary search ,before this one use sort command.

3. use Secondary index in where condition if table created secondary index for MSEG.

use all where condition .

if it is useful give me award points

Thanks

Seshu

Sathish
Employee
Employee
0 Kudos

Former Member
0 Kudos

Hi Akash ,

Try to use the view WB2_V_MKPF_MSEG to get the data .

This will improve your performance .

Regards ,

Praveen .