Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

line-deletion

Former Member
0 Kudos

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

6 REPLIES 6

JozsefSzikszai
Active Contributor
0 Kudos

hi Deep,

try DELETE ADJECENT DUPLICATES

ec

Former Member
0 Kudos

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.

0 Kudos

thanks for responce me,

i didn't understand ur logic.

canu give me sample code(URGENT).

thanks in advance and full reward.

regard : deep

Former Member
0 Kudos

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.

Former Member
0 Kudos

TRY WITH COLLECT STATEMENT

Former Member
0 Kudos

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