10-09-2007 12:34 PM
hi to all experts,
in my internal table have some lines of records.
in this line is repeted also.
i want to delete single lines of records not duplicate lines .
i.e finally i want to duplication lines of records .
how i solve this issue.
thanks in advance and regard also.
regard : deep
10-09-2007 12:38 PM
10-09-2007 12:38 PM
Hi Deep,
If I have understood you correctly,you have an internal table which consists of lines of records of which some are repeated and rest are single lines of records and you want to delete the single lines of records.
In this case,Sort the internal table on some key field.
Then use control level statements AT NEW and raise the counter on every new line of the same kind.
If the counter is greater than 1 before the second AT NEW processes,continue else Delete the single line of record.
In case you have any further clarifications,do let me know.
Regards,
Puneet Jhari.
10-09-2007 1:35 PM
thanks for responce me,
i didn't understand ur logic.
canu give me sample code(URGENT).
thanks in advance and full reward.
regard : deep
10-09-2007 12:39 PM
HI,
do like this.
data:itab like mara occurs 0 WITH HEADER LINE.
data:jtab like mara occurs 0 WITH HEADER LINE.
DATA:wa like mara.
LOOP AT itab into wa.
DELETE ADJACENT DUPLICATES FROM itab COMPARING ALL FIELDS.
IF sy-subrc = 0.
APPEND wa to jtab.
ENDIF.
ENDLOOP.
rgds,
bharat.
10-09-2007 12:48 PM
10-09-2007 1:35 PM
Hi deep,
Please try with the following logic,this program will display only the duplicated
records.
data: begin of itab occurs 0,
name(10) type c,
address(30) type c,
end of itab.
data: v_rec like itab-name.
itab-name = 'name'.
itab-address = 'address'.
append itab.
itab-name = 'name1'.
itab-address = 'address1'.
append itab.
itab-name = 'name2'.
itab-address = 'address2'.
append itab.
itab-name = 'name3'.
itab-address = 'address3'.
append itab.
itab-name = 'name2'.
itab-address = 'address3'.
append itab.
itab-name = 'name3'.
itab-address = 'address5'.
append itab.
write:/ 'itab contents'.
loop at itab.
write:/ itab-name,itab-address.
endloop.
uline.
skip.
sort itab.
loop at itab.
on change of itab-name.
v_rec = itab-name.
if v_rec <> ' '.
delete itab.
endif.
endon.
endloop.
write:/ 'duplicate contents in itab'.
loop at itab.
write:/ itab-name,itab-address.
endloop.
Regards
Varalakshmi.K