‎2007 Aug 10 4:50 PM
hi,
in genral we loop by row like
loop at itab
-
end loop
my requirement is to loop itab by column
can any one give me idea
its urgent...............
‎2007 Aug 10 4:53 PM
There is nothing like looping by column. Once you have read a record of the table into work area, you have access to all the fields of that internal table.
What do you want to do?
‎2007 Aug 10 4:53 PM
Hi,
It is NOT Possible. You need to LOOP by Rows only and then you can do your processing for each column.
Regards,
Atish
‎2007 Aug 10 4:54 PM
Turn the internal table "on it's side"... and then loop thru it as needed.
‎2007 Aug 10 4:54 PM
Hi,
You can not loop by column.
But you can sort the internal table by column (ascending or descending order) prior to loop.
Regards,
Ferry Lianto
‎2007 Aug 10 5:02 PM
You could loop at the columns by using Field-symbols.
Basically DESCRIBE the structure and loop thru its components.
You would then loop thru column using the currently, assigned Field-symbola nd then address each row as neede (using a LOOP or READ TABLE with wan INDEX).
‎2007 Aug 10 5:06 PM
Hi,
Doesn't exists columns loop, but you can do as follow.
DATA: ttable TYPE TABLE OF mara WITH HEADER LINE.
FIELD-SYMBOLS <field> TYPE ANY.
LOOP AT ttable.
" Each column of ttable is moved to <field>
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE ttable TO <field>.
IF sy-subrc IS INITIAL.
WRITE <field>. "Here is a column value
ELSE.
EXIT." Exit when all collumn is processed
ENDIF.
ENDDO.
ENDLOOP.<b>Don't forget to close this Thread and reward points for useful answers when your question be answered.</b>
Regards.
Marcelo Ramos
‎2007 Aug 10 5:30 PM
i want to loop by column but as all replied that there is no such process i have to see some other way
‎2007 Aug 10 6:02 PM
Not really true.... there is no pre-built option for this.
You could use FIELD-SYMBOLS as mentioned above and take a snapshot of the internal table's struecture (meaning the columns) and then LOOP thru the columns first then read the rows.
But it is true that ABAP does not "naturally" support your needs.