Skip to Content
Former Member
Oct 24, 2006 at 01:01 AM

dynamic columns


Hi all,

Suppose i have this code:

<b>loop at table into line.


if line-column1 eq 'something'.



with that i search if the column line-column1 is equal to 'something', and if it is i do something. That works fine, but now i'm facing a problem.

The column that i need to search may be other of about 60 columns. It's the column i get in a string. For instance:

<b>data: text type string.

text = 'column1'.</b>

Is anyway to somehow get the value of a column by a string? In other words:

- if <b>text='column1'</b> the validation should look as <b>if line-column1 eq 'something'.</b>

- if <b>text='column2'</b> the validation should look as <b>if line-column2 eq 'something'.</b>

If the table had few columns a simple case/when, or even if/else would work, but this is a table with more than 60 columns, so it's an option i'm trying to avoid.

Most likelly i need to store the value of the column i want to search in a string and then use it to compare in IF, but i don't know how.

Some people told me that it might me done with field-symbols and appends, but since i'm kind of newbie in abap world i'm not managing to do that.

Can anyone help me with this?

Thanks in advanced for any help.