‎2008 Aug 22 10:06 AM
‎2008 Aug 22 10:11 AM
‎2008 Aug 22 10:11 AM
‎2008 Aug 22 10:11 AM
‎2008 Aug 22 10:16 AM
hi Mathew Parera
chk this sample code
Entries: 100 (ITAB1), 1000 (ITAB2)
Line width: 100
Both tables sorted by key K
LOOP AT ITAB1 INTO WA1.
LOOP AT ITAB2 INTO WA2
WHERE K = WA1-K.
" ...
ENDLOOP.
ENDLOOP.
Entries: 1000 (ITAB1), 300 (ITAB2)
Line width: 100
Both tables sorted by unique key K ascending
LOOP AT ITAB1 INTO WA1.
READ TABLE ITAB2 INTO WA2
WITH KEY K = WA1-K BINARY SEARCH.
IF SY-SUBRC = 0.
" ...
ENDIF.
ENDLOOP.
regards
Deva
‎2008 Aug 22 10:18 AM
Hi,
plz try this way :
sort : itab1 by num,
itab2 by num.
loop at itab1.
read table itab2 with key num = itab1-num binary search.
if sy-subrc = 0.
flag = 'X'.
else.
exit.
endif.
hope this helps.
thanx,
dhanashri.
‎2008 Aug 22 10:25 AM
Try it this way:
loop at itab1 into wa1.
describe table itab2 lines w_line.
do w_line times.
read table itab2 into wa2 index counter.
if wa2-field = wa1-field.
.........
endif.
counter = counter + 1.
enddo.
endloop.With luck,
Pritam.
‎2008 Aug 22 10:34 AM
Hi,
Try this.
Loop at itab1 into wa_itab.
read table itab2 into wa_itab2 with key f1 = wa_itab1-f1.
if sy-subrc eq 0.
< carry out ur requirement>
endif.
endloop.
Sharin.
‎2008 Aug 22 10:35 AM
hi,
check out this code. i am giving the raw idea to compare internal table field.
types: begin of gs_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
end of gs_vbak.
data: it_vbak type standard table of gs_vbak,
wa_vbak type gs_vbak.
****************************************************
types: begin of gs_vbap,
VBELN type vbap-VBELN, "sales order
MATNR type vbap-MATNR, "material no
ARKTX type vbap-ARKTX, "material description
end of gs_vbap.
data: it_vbap type standard table of gs_vbap,
wa_vbap type gs_vbap.
****************************************************
select-options: s_vbeln for vbak-vbeln.
select vbeln
erdat
kunnr
ernam from vbak into table it_vbak where vbeln in s_vbeln.
select VBELN
MATNR
ARKTX
from vbap into table it_vbap up to 20 rows.
loop at it_vbak into wa_vbak.
read table it_vbap into wa_vbap INDEX sy-index.
if wa_vbak-vbeln = wa_vbap-vbeln.
write: 'vbeln for both table are equal'.
elseif wa_vbak-vbeln GT wa_vbap-vbeln.
write: -
else.
write: -
endif.
endloop.