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 adjcacent fields!

Former Member
0 Likes
493

Hi experts

I have three columns on an internal table that goes into an ALV report.

A B C

1 100 590

1 100 10

2 52 350

2 55 120

2 55 180

And i want this...

A B C

1 100 590

10

2 52 350

2 55 120

180

I want to delete adjacent duplicates but not deleting the whole row... just one field of the row..

how can i do it? thanks

4 REPLIES 4
Read only

Former Member
0 Likes
476

So if A and B are duplicated you want to put the C value in A?

Edit: I think another good way would be to erase A and B and leave C alone

Edited by: Ramiro Escamilla on May 15, 2008 5:47 PM

Read only

0 Likes
476

When A and B are the same, i want to place " " and column C doesnt move...

but i want to place at least one record of A and B

i cannot delete any columns...

Read only

0 Likes
476

types: begin of this_type,
a(3),
b(3),
c(3),
end of this_type.

data: itab type table of this_type with header line,
      prev type this_type.
itab-a = 2. itab-b = 52. itab-c = 350. append itab.
itab-a = 1. itab-b = 100. itab-c = 590. append itab.
itab-a = 2. itab-b = 55. itab-c = 120. append itab.
itab-a = 1. itab-b = 100. itab-c = 10. append itab.
itab-a = 2. itab-b = 55. itab-c = 180. append itab.

sort itab by a b c descending.

loop at itab.
if prev-a = itab-a and prev-b = itab-b.
clear: itab-a, itab-b.
modify itab index sy-tabix.
endif.

prev = itab.
write:/ itab-a, space, itab-b, space, itab-c.
endloop.

Check this, altough you need to have some sort, I can't see how you sorted that table

Read only

Former Member
0 Likes
476

try some like this....

data count type i.

sort table by a b.

loop at i_table.

at new a.

clear count.

endat.

count = count + 1.

IF count > 1.

IF a = b.

a= c.

clear: b, c.

endif.

endif.

endloop.