‎2007 Apr 20 6:00 AM
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
‎2007 Apr 20 6:24 AM
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
‎2007 Apr 20 9:14 AM
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
‎2007 Apr 20 2:01 PM
hi,
use binary search with read statement.and create secondary indexes for mseg fields.
thanks & regards,
j.prakash.
‎2007 Apr 21 2:27 PM
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.
‎2007 Apr 23 12:16 PM
Hi ,
Check this sap note for custom developments in MM module...
191492 Performance: Customer developments in MM/WM
Regards,
K Vijayasekar
‎2007 Apr 23 5:11 PM
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
‎2007 Apr 24 4:40 AM
‎2007 Apr 25 12:34 PM
Hi Akash ,
Try to use the view WB2_V_MKPF_MSEG to get the data .
This will improve your performance .
Regards ,
Praveen .