04-28-2009 2:23 PM
Hi All.
Please sugget me how to improve the performance for the logic as given below.
loop at i_vbep.
loop at i_z1234 where vbeln_va = i_vbep-vbeln
and posnr_va = i_vbep-posnr.
at end of zpd.
sum.
v_tot_quantity_kg = i_z1234-brgew.
endat.
loop at i_z5678 where zpd = i_z1234-zpd
and zld = i_z01234-zlegid.
at end of zpallid.
sum.
v_tot_quantity = i_z5678-zcpalqty.
endat.
clear i_mara.
read table i_mara with key matnr = i_z5678-zpmatnr
binary search.
if sy-subrc = 0.
perform convert_m2 using v_tot_quantity
i_z5678
i_mara.
modify table i_z5678.
endloop.
endloop.
04-28-2009 3:05 PM
What is the logic required? Is this piece working fine?
First try would be to sort the internal tables by keys.
04-28-2009 3:56 PM
04-28-2009 4:15 PM
loop at i_vbep.
loop at i_z1234 where vbeln_va = i_vbep-vbeln
and posnr_va = i_vbep-posnr.
The READ BINARY SEARCH solves only on part of the problems, the other is the LOOP WHERE
on standard tables.
Either use Sorted tables or optimize the loop on standard table, see here
Measurements on internal tables: Reads and Loops:
/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables
see section 3
Siegfried
04-29-2009 8:10 AM
Hi,
Can try following options:
1. Use internal table w/o header linei.e. use explicit work area. Better is to use field symbol.
2. Use read with binary search
3. You have 3 nested loop - check where is the performance bottleneck. If it is in the Read statement binary search will help you.
4. Check if you can avoid so many nested loop.