Application Development and Automation 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: 
Read only

Delete same records.

Former Member
0 Likes
912

hi expert,

i have a requirment that i need to delete same records from two internal table without using LOOP statement..

so plz help me in solving this query.

thanks

9 REPLIES 9
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
893

do enddo.

while endwhile....???

Read only

Former Member
0 Likes
893

Hi!

Use a DELETE statement with a WHERE clause for both the internal tables.

Cheers!

Read only

Former Member
0 Likes
893

You can use one loop statement.

loop at itab1.

read table itab2 with key [[ur condition]].

if sy-subrc = 0. "If condition satisfied

delete itab1 index sy-tabix.

endif.

clear: itab1,itab2.

endloop.

Regards,

Aparna.

Read only

Former Member
0 Likes
893

Hi,

Use like this..


SORT itab by fieldname.
DELETE ADJACENT DUPLICATES FROM itab COMPARING fieldname1 fieldname2

Read only

Former Member
0 Likes
893

If both the internal tables are of same structure you can try as;

APPEND LINES OF itab1 TO itab2.
SORT itab2 BY col1 col2.
DELETE ADJACENT DUPLICATES FROM itab2 COMPARING col1 col2.

Using the above logic will solve your problem.

Regards

Karthik D

Read only

0 Likes
893

Done !!!!!

Read only

Former Member
0 Likes
893

hi i dont need to move the records from one table to another table.

Read only

0 Likes
893

Anyhow you want to delete the duplicate records, then do you think its possible without using LOOP as well as moving records to one table.

May we ask the reason for not using the LOOP and moving of records to one itab.

Also list what are the Dont's that are too be considered while giving you a solution.

Regards

Karthik D

Read only

Former Member
0 Likes
893

Hi,

Try out this.

Declare the internal table of sorted type with unique key.

Doing this it will not fetch duplicate records hence no need to delete.

Hope this helps you out.

Thanks & Regards