Hi,
I have a structured field at runtime and I use the following algorithm to run through the field content:
DATA: l_components TYPE I,
comp_idx TYPE I,
t TYPE C.
DESCRIBE FIELD m_cu_aprc TYPE t COMPONENTS l_components.
CHECK t = 'u'. "We need a structure
DO l_components TIMES.
FIELD-SYMBOLS: <rc> TYPE ANY.
ASSIGN COMPONENT sy-index OF STRUCTURE m_cu_aprc TO <rc>.
IF sy-subrc = 0.
IF releaseCode = <rc>.
"This field has the assigned release code
comp_idx = sy-index.
EXIT.
ENDIF.
ENDIF.
ENDDO.
IF comp_idx > 0.
"...
Now I do have a second structure that holds at any one field position a field with the same name as the component that I have just found using the comp_idx.
So I cannot use the statement:
ASSIGN COMPONENT comp_idx OF STRUCTURE target TO <field_symbol>.
... as the component's index is not the same as the previous structure of m_cu_aprc (as mentioned above).
So what I'd like to achieve is the name of that component that is linked to comp_idx so I could use the following statement:
ASSIGN COMPONENT comp_name OF STRUCTURE target TO <field_symbol>.
The type of the structure m_cu_aprc is not known at compile time.
Any ideas?
Florin