‎2008 May 15 11:37 PM
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
‎2008 May 15 11:41 PM
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
‎2008 May 15 11:54 PM
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...
‎2008 May 16 12:05 AM
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
‎2008 May 16 12:00 AM
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.