2008 Feb 19 11:22 AM
Hi All,
I have two internal tables with same structure like: IT_REC_LIST and IT_REC_LIST_DEL.
I have 10 records in this internal table: IT_REC_LIST and same 5 records in this internal table: IT_REC_LIST_DEL. I dont have any key fields.
So I want to delete those 5 records from IT_REC_LIST. Could you please let me know hw to write the code, when I write like below its going for dump.
DELETE IT_REC_LIST [] FROM IT_REC_LIST_DEL [].
Akhitha.
Hi All,
I have two internal tables with same structure like: IT_REC_LIST and IT_REC_LIST_DEL.
I have 10 records in this internal table: IT_REC_LIST and same 5 records in this internal table: IT_REC_LIST_DEL. I dont have any key fields.
So I want to delete those 5 records from IT_REC_LIST. Could you please let me know hw to write the code, when I write like below its going for dump.
DELETE IT_REC_LIST [] FROM IT_REC_LIST_DEL [].
Akhitha.
2008 Feb 19 11:28 AM
loop at IT_REC_LIST_DEL.
DELETE IT_REC_LIST FROM IT_REC_LIST_DEL .
endloop.
2008 Feb 19 11:33 AM
Hello,
You can do like :
loop at IT_REC_LIST .
read table IT_REC_LIST_del with key field1 = IT_REC_LIST-field1.
if sy-subrc eq 0.
delete IT_REC_LIST.
endif.
endloop.
<REMOVED BY MODERATOR>
Vasanth
Edited by: Alvaro Tejada Galindo on Feb 19, 2008 5:28 PM
2008 Feb 19 11:40 AM
there must be a field similar in two itabs..
without that based on what u r deleting..it makes no sense.
2008 Feb 19 11:43 AM
Ya, i got it,
all are same fields in both internal tbales, but its not key fields..
2008 Feb 19 11:48 AM
data:wa1 like itab1.
data:wa2 like itab2.
Loop at it1 into wa1.
read table it2 into wa2 with key <field1> = <wa1-field1>
<field2> = <wa1-field2>
<field3> = <wa1-field3>
<field4> = <wa1-field4>
<field5> = <wa1-field5>.
if sy-subrc = 0.
delete it1 from wa1.
endif.
endloop.
2008 Feb 19 11:49 AM
hi,
lets have itab with 10 fields.
itab1 with 5 fields.
then
loop at itab.
delete itab1 where col2 = itab-col1.
endloop.
loop at itab1.
write : itab1-col2.
endloop.
try this.
2008 Feb 19 11:59 AM
hw u r saying that, what is col2 and what is col1, i dont think that will work.....
Akshitha.
2008 Feb 19 12:00 PM
2008 Feb 19 12:04 PM
Im sure, that will work, but its not that much lengthy code, it should come for only one or two lines as they are expecting, thats why im thinking.....! any other alternate.
Akshitha.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |