2008 Mar 25 8:49 AM
hi,
Please explain with exactly how the parallel cursor means (Whether only using INDEX).
I have a scenario like this
three internal tables i am using loop at itab WHERE,
how to make the same using parallel cursor, which will improve the performance.
chk this i want similar scenario.
tables:ekko,ekpo.
*parameter: p_ebeln like ekko-ebeln.
select-options: p_ebeln for ekko-ebeln.
data: i type i.
data: itab1 type table of ekko with header line,
itab2 type table of ekpo with header line,
itab3 type table of ekbe with header line.
select * from ekko into table itab1 where ebeln in p_ebeln.
select * from ekpo into table itab2 where ebeln in p_ebeln.
select * from ekbe into table itab3 where ebeln in p_ebeln.
*i = 1.
loop at itab1.
write / 'loop 1'.
loop at itab2 where ebeln = itab1-ebeln.
write / 'loop2'.
loop at itab3 ebeln = itab2-ebeln ebelp = itab2-ebelp.
write / 'loop3'.
endloop.
endloop.
endloop.
regards,
Prabhu
Points assured.
2008 Mar 25 9:09 AM
Try the below code. Hope it helps.
sort iekpo by ebeln ebelp.
sort iekbe by ebeln ebelp.
loop at iekko.
clear: lv_inx.
read table iekpo with key ebeln = iekko-ebeln binary search.
if sy-subrc = 0.
lv_indx = sy-tabix.
loop at iekpo from lv_indx.
if iekko-ebeln = iekpo-ebeln.
clear: lv_indx1.
read table iekbe with key ebeln = iekpo-ebeln
ebelp = iekpo-ebelp
binary search.
if sy-subrc = 0.
lv_indx1 = sy-tabix.
loop at iekbe from lv_indx1.
if iekpo-ebeln = iekbe-ebeln and
iekpo-ebelp = iekbe-ebelp.
<<< do ur logic>>
else.
clear: lv_indx1.
exit.
endif.
endloop.
else.
clear: lv_indx.
exit.
endif.
endloop.
endif.
endloop.
Thanks,
Balaji
[www.saptechnical.com/Tutorials/ABAP/ParallelCursor.htm]
Got to this link what u require is there perfect with examples
and about the performances while using parallel cursor
regards,
priya.
2008 Mar 25 9:09 AM
Try the below code. Hope it helps.
sort iekpo by ebeln ebelp.
sort iekbe by ebeln ebelp.
loop at iekko.
clear: lv_inx.
read table iekpo with key ebeln = iekko-ebeln binary search.
if sy-subrc = 0.
lv_indx = sy-tabix.
loop at iekpo from lv_indx.
if iekko-ebeln = iekpo-ebeln.
clear: lv_indx1.
read table iekbe with key ebeln = iekpo-ebeln
ebelp = iekpo-ebelp
binary search.
if sy-subrc = 0.
lv_indx1 = sy-tabix.
loop at iekbe from lv_indx1.
if iekpo-ebeln = iekbe-ebeln and
iekpo-ebelp = iekbe-ebelp.
<<< do ur logic>>
else.
clear: lv_indx1.
exit.
endif.
endloop.
else.
clear: lv_indx.
exit.
endif.
endloop.
endif.
endloop.
Thanks,
Balaji
2008 Mar 25 11:01 AM
Hi Balaji,
The code is fine if have one entry in itab2 for itab1 and one entry for itab3 in itab1 then you code is fine.
But if we have 2 record(itab2) for 1 entry in itab1 and so on it doesn't work as per the requirement
regards,
Prabhu
2008 Mar 25 11:55 AM
Try the below code.
sort iekpo by ebeln ebelp.
sort iekbe by ebeln ebelp.
loop at iekko.
write:/ iekko.
clear: lv_inx.
read table iekpo with key ebeln = iekko-ebeln binary search.
if sy-subrc = 0.
lv_indx = sy-tabix.
loop at iekpo from lv_indx.
if iekko-ebeln = iekpo-ebeln.
write:/ iekpo.
clear: lv_indx1.
read table iekbe with key ebeln = iekpo-ebeln
ebelp = iekpo-ebelp
binary search.
if sy-subrc = 0.
lv_indx1 = sy-tabix.
loop at iekbe from lv_indx1.
if iekpo-ebeln = iekbe-ebeln and
iekpo-ebelp = iekbe-ebelp.
write:/ iekbe.
<<< do ur logic>>
else.
clear: lv_indx1.
exit.
endif.
endloop.
endif.
endloop.
endif.
endloop.
Hope this helps.
Thanks
Balaji
2008 Mar 25 12:27 PM
hi balaji,
Thanx, whether this will be more efficient then using Loop at with where condition.
regards,
Prabhu
2008 Mar 25 12:31 PM
This will be more efficient when the number of records in itab1, itab2 and itab3 are more.
This will reduce lot of processing time.
Rwd points if helpful.
Thanks
Balaji
2008 Mar 25 12:37 PM
[www.saptechnical.com/Tutorials/ABAP/ParallelCursor.htm]
Got to this link what u require is there perfect with examples
and about the performances while using parallel cursor
regards,
priya.
2008 Mar 25 12:47 PM
Hi,
see this link.
/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops
Rob shows the performance comparing 4 routines, including nested loop, indexed and parallel.
and this.
/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables
Siegfried explain how parallel works. Good job
Regards!
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |