10-22-2007 12:26 PM
hi Abapers,
anyone can plx help me with performance in loop 2 times?
I need something like this:
LOOP AT ti_sbook FROM sbook_index.
READ TABLE ti_spfli BINARY SEARCH.
WHILE sy-subrc = 0.
cont1 = cont1 + 1.
spfli_index = spfli_index + 1.
READ TABLE ti_spfli INDEX spfli_index.
ENDWHILE.
spfli_index = 1.
sbook_index = sbook_index + 1.
ENDLOOP.
obs: I need to read all records.
Regards
Allan Cristian
10-22-2007 12:29 PM
Hi Allan,
There should be some common field between TI_SBOOK & TI_SPFLI.
LOOP AT ti_sbook FROM sbook_index.
READ TABLE ti_spfli with key sno = ti_sbool-sno binary search.
ENDLOOP.
BEst regards,
Prashant
10-22-2007 12:28 PM
Hi Allan,
Can you please let us know your requirement exactly?
Satish
10-22-2007 12:36 PM
hi Satish,
I need to read itab2 for each record of itab1.
I excludes no records necessary before.
I need cont for example, how many register is in itab1 from itab2 and how many isn't at each record of itab2.
can be Select with endselect, loop...
I need do it passing for all entries
Regards
Allan Cristian
Message was edited by:
Allan Cristian
10-22-2007 12:50 PM
Allan,
do like this.
loop at itab1 into wa1.
read table itab2 with key f1 = wa1-f1.
if sy-subrc = 0.
cnt1 = cnt1 + 1.
else.
cnt2 = cnt2 + 1.
delete itab1 where f1 = wa1-f1.
endif.
endloop.
write : cnt1,cnt2.
Hope this will help you.
<b><REMOVED BY MODERATOR></b>
Satish
Message was edited by:
Alvaro Tejada Galindo
10-22-2007 12:29 PM
Hi Allan,
There should be some common field between TI_SBOOK & TI_SPFLI.
LOOP AT ti_sbook FROM sbook_index.
READ TABLE ti_spfli with key sno = ti_sbool-sno binary search.
ENDLOOP.
BEst regards,
Prashant
10-22-2007 12:38 PM
Hi, you dont need to pass in full records.
if you want to gain performance check the indexed loop, like this:
LOOP AT bkpf_tab INTO bkpf_lin.
READ TABLE bseg_tab INTO bseg_lin
WITH KEY bukrs = bkpf_lin-bukrs
BINARY SEARCH.
bseg_index = sy-tabix.
IF sy-subrc = 0.
*-- PERFORM EXECUCAO
ENDIF.
WHILE sy-subrc = 0.
bseg_index = bseg_index + 1.
READ TABLE bseg_tab
INTO bseg_lin
INDEX bseg_index.
IF bseg_lin-bukrs <> bkpf_lin-bukrs.
sy-subrc = 99.
ELSE.
*-- PERFORM EXECUCAO
ENDIF.
ENDWHILE.
ENDLOOP.
if you want just to count the values, do the nested loop...
Regards
10-22-2007 1:49 PM
Hi Allan,
is your problem got resolved? Reward points for the helpful answers.
Satish
10-22-2007 1:59 PM
hi Satish,
at time it's not solved,
Dont worry, I'll reward for the answers, I'm working at...
<b><REMOVED BY MODERATOR></b>
Regards
Allan Cristian
Message was edited by:
Allan Cristian
Message was edited by:
Alvaro Tejada Galindo
10-22-2007 2:01 PM
Hi Allan,
I think the best way is to go with two loops and check the performance in SE30.
Regards,
Atish