Skip to Content
May 15, 2013 at 07:27 AM

Loop at itab Where


Hello ,

I have internal table with several collons. In colon three the values can be repeated , and I have to read only the firs one

something like this

col1 col2 col3

1 A Y

2 B Y

5 N Y

3 V X

7 T X

I have to readd only the first line of each entry in Col3 so in this case i am interested only in line 1 A Y , and 3 V X .

I tryed wirh at new col3 but id doesn work because col1 and colé are not unique . Than I tryed with loop where statement .

with this code .

data lv_col3 like itab-col3

Loop at itab in wa

where col3 NE lv_col3.

lv_col3 = wa_col3


The idea was to pass the value of col3 to local variable and in next loop take the same in "where" condition. It doesnt work .The loop goes trough all lines of internal table.

The intrenal table is declared like this itab TYPE TABLE OF pc261 ( structure ).

colon ther and local vareiable are char 6 type.

Please can you explain why where statement doesnt work in this case and advice how can i get only the first entry of each value of the colon 3.