Application Development and Automation 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: 
Read only

MSEG Performance Issue

Former Member
0 Likes
1,136

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
Read only

Former Member
0 Likes
953

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

Read only

Former Member
0 Likes
953

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

Read only

Former Member
0 Likes
953

hi,

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

thanks & regards,

j.prakash.

Read only

Former Member
0 Likes
953

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.

Read only

VijayasekarK
Active Participant
0 Likes
953

Hi ,

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

191492 Performance: Customer developments in MM/WM

Regards,

K Vijayasekar

Read only

Former Member
0 Likes
953

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

Read only

Sathish
Product and Topic Expert
Product and Topic Expert
0 Likes
953
Read only

Former Member
0 Likes
953

Hi Akash ,

Try to use the view WB2_V_MKPF_MSEG to get the data .

This will improve your performance .

Regards ,

Praveen .