2007 Sep 12 2:41 PM
Hi All,
Is it possible to read a table by its column index ??
Suppose if I have to read the 6th column(without knowing the name) in a particular row of an internal table, is that possible ?
Please suggest.
Thanks in advance,
Archana.
2007 Sep 13 9:07 AM
Hi Archana,
try this
suppose u want to read 5th row 6th column
Field-symbols : <FS> type any.
loop at itab.
if sy-tabix eq 5.
do.
assign component 'FIELD6' of structure itab to <FS>.
if sy-subrc eq 0.
exit.
endif.
enddo.
endif.
endloop.<FS> will contain the value of 6th column
Message was edited by:
Chandrasekhar Jagarlamudi
2007 Sep 12 2:43 PM
I guess you want to read table rows you can use statement
read table <itab name> index 6
2007 Sep 12 2:50 PM
Hi, read return 1 record...because use keys.. column have not sense.
regs
2007 Sep 13 8:56 AM
Hi,
I want to read columns of the tables, b'cos the keys will not be known till runtime.
Since the column name is not known I cannot use 'KEYS' but the column index is known to me. So, I am exploring the possibility to read the table's column for a particular row, if we have the column number.
Does anybody have any suggestions for this ?
2007 Sep 13 9:01 AM
Hi,
Yes u can do that using Field symbols.
DO you know the field symbols concept. This is only possible with Field symbols, as i did the same in one of my requirement.
Read table itab with key <fs1> = ____.
Revert back if any issues,
Reward with points if helpful.
Regards,
Naveen
2007 Sep 13 9:07 AM
Hi Archana,
try this
suppose u want to read 5th row 6th column
Field-symbols : <FS> type any.
loop at itab.
if sy-tabix eq 5.
do.
assign component 'FIELD6' of structure itab to <FS>.
if sy-subrc eq 0.
exit.
endif.
enddo.
endif.
endloop.<FS> will contain the value of 6th column
Message was edited by:
Chandrasekhar Jagarlamudi
2007 Sep 13 9:15 AM
Hi Chandrashekhar,
Is 'field6' the name of the column, because that will not be known.
I know how to read the 6th field using the field name but I want to know if it can be read only using the column index.
2007 Sep 13 9:24 AM
hi Archana,
try this
loop at itab.
if sy-tabix eq 5.
do.
if sy-index eq 6.
assign component sy-index of structure itab to <FS>.
if sy-subrc eq 0.
exit.
endif.
endif.
enddo.
endif.
endloop.
2007 Sep 13 9:09 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |