06-04-2008 4:11 AM
Hi,
How to get the field name dynamically from an internal table.
For ex:
I need to assign some fields based on some condition, but i dont know which fields meet the condition.
Loop at it_pos.
Loop at it_fieldcat.
if it_fieldcat-no_out = ' '.
Now how to get the field name dynamically
it_display-(it_fieldcat-fieldname) = it_pos-(it_fieldcat-fieldname)*.
this code is giving error, what is the correct syntax for such assignments
Thanks,
Ravi K
06-04-2008 4:23 AM
HI,
Better way to do this is to use field symbols.
Use class cl_abap_structdescr to get the components of your structure and then use field symbols to compare values
ASSIGN COMPONENT <comp> OF STRUCTURE <your structure> TO <FS>.
Shruthi
06-04-2008 4:21 AM
u have to use fieldsymbol for this.
go to abap editor write fieldsymbols and press F1 .
u will get help for fieldsymbols.
Edited by: Suyog Haralikar on Jun 4, 2008 5:25 AM
06-04-2008 4:23 AM
HI,
Better way to do this is to use field symbols.
Use class cl_abap_structdescr to get the components of your structure and then use field symbols to compare values
ASSIGN COMPONENT <comp> OF STRUCTURE <your structure> TO <FS>.
Shruthi