2010 Feb 28 2:14 AM
hi i have one internal table T_STAT like that
vbeln posnr matnr
111 10 abc
111 20 def
112 10 abc
112 20 abc
113 30 def
I am using read table compare only matnr. means the line items which contain matnr abc should move other internal table.
but it is moving only one record. is it possible without loop.
2010 Feb 28 10:56 AM
hi,
try this
data T_STAT_ABC like T_STAT occurs 0.
T_STAT_ABC[] = T_STAT[].
delete T_STAT_QBC where MATNR NE 'ABC'.
you have in T_STAT_ABC entry with matnr = 'ABC' without used loop. CQFD
Rgds
hi i have one internal table T_STAT like that
vbeln posnr matnr
111 10 abc
111 20 def
112 10 abc
112 20 abc
113 30 def
I am using read table compare only matnr. means the line items which contain matnr abc should move other internal table.
but it is moving only one record. is it possible without loop.
2010 Feb 28 7:40 AM
READ TABLE reads just one record. So in your case, it will not work. You use
LOOP at ITAB WHERE MATNR eq 'abc'.
move the records to another internal table.
ENDLOOP.
2010 Feb 28 10:13 AM
I think you are doing this with two itabs.
Loop at itab1 into wa. "The matnr to be checked
loop at itab2 into wa2 from wk_tabix. "The records to be moved.
if wa2-matnr ne wa-matnr.
wk_tabix = sy-tabix.
exit.
endif.
move-corresponding wa2 to wa3.
append wa3 to itab3.
endloop.
endloop.
2010 Feb 28 10:56 AM
hi,
try this
data T_STAT_ABC like T_STAT occurs 0.
T_STAT_ABC[] = T_STAT[].
delete T_STAT_QBC where MATNR NE 'ABC'.
you have in T_STAT_ABC entry with matnr = 'ABC' without used loop. CQFD
Rgds
2010 Mar 01 7:47 AM
Hi Priyank,
Try with the below mentioned code :
data : begin of itab occurs 0,
vbeln(3) type c,
posnr(2) type c,
matnr(3) type c ,
end of itab.
*data : itab type table of ty_tab,
* wa_itab like line of itab.
data : ind type i value 1.
data : it_final like itab occurs 0.
data : recs type i.
itab-vbeln = '111'.
itab-posnr = '10'.
itab-matnr = 'abc'.
append itab.
clear itab.
itab-vbeln = '111'.
itab-posnr = '20'.
itab-matnr = 'def'.
append itab.
clear itab.
itab-vbeln = '112'.
itab-posnr = '10'.
itab-matnr = 'abc'.
append itab.
clear itab.
itab-vbeln = '112'.
itab-posnr = '20'.
itab-matnr = 'abc'.
append itab.
clear itab.
itab-vbeln = '113'.
itab-posnr = '30'.
itab-matnr = 'def'.
append itab.
clear itab.
read table itab.
recs = sy-tfill.
while ind LE recs.
read table itab into itab index ind.
if itab-matnr = 'abc'.
append itab to it_final.
clear itab.
endif.
ind = ind + 1.
endwhile.
Cheers
VJ
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |