2007 Aug 14 1:02 PM
Hi forums,
i need to loop the columns and rows of a table, so i created a fieldcatalog and loop the rows of the table in the outer-loop and the rows of the catalog in the inner loop.
See the code below, wa_fieldcat-fieldname contains the fieldname of the field i want assign to item-text.
LOOP AT stueckliste INTO wastueckliste.
LOOP AT fieldcat INTO wa_fieldcat.
item-item_name = wa_fieldcat-fieldname.
item-text = wastueckliste-{i need content of wa_fieldcat-fieldname here}
endloop.
ENDLOOP.
eg. if wa_fieldcat-fieldname contains the string 'matnr', item-text shall become the content of wastueckliste-matnr, i hope you understand what i mean... i've already tried to assign wa_fieldcat-fieldname to a a fieldsymbol and access the field by wastueckliste-<fs> but that doesn't work, too...
btw: i know that snippet doesn't do nothing, its just an example...
Message was edited by:
Adam Pyschny
2007 Aug 14 1:30 PM
Hi,
Try this way,
DATA: stueckliste ...
DATA: wastueckliste ...
DATA: fieldcat ...
DATA: wa_fieldcat ...
FIELD-SYMBOLS <field> TYPE ANY.
LOOP AT stueckliste INTO wastueckliste.
LOOP AT fieldcat INTO wa_fieldcat.
item-item_name = wa_fieldcat-fieldname.
" Here you are moving the field 'matnr' of wastueckliste to a field-symbol
ASSIGN COMPONENT wa_fieldcat-fieldname
OF STRUCTURE wastueckliste TO <field>.
" IF ok, just use <field> as wastueckliste-matnr
IF sy-subrc IS INITIAL.
item-text = <field>.
ELSE.
" error
ENDIF.
ENDLOOP.
ENDLOOP.
<b>Don't forget to close this Thread and reward points when your question be answered.</b>
Regards.
Marcelo Ramos
Hi forums,
i need to loop the columns and rows of a table, so i created a fieldcatalog and loop the rows of the table in the outer-loop and the rows of the catalog in the inner loop.
See the code below, wa_fieldcat-fieldname contains the fieldname of the field i want assign to item-text.
LOOP AT stueckliste INTO wastueckliste.
LOOP AT fieldcat INTO wa_fieldcat.
item-item_name = wa_fieldcat-fieldname.
item-text = wastueckliste-{i need content of wa_fieldcat-fieldname here}
endloop.
ENDLOOP.
eg. if wa_fieldcat-fieldname contains the string 'matnr', item-text shall become the content of wastueckliste-matnr, i hope you understand what i mean... i've already tried to assign wa_fieldcat-fieldname to a a fieldsymbol and access the field by wastueckliste-<fs> but that doesn't work, too...
btw: i know that snippet doesn't do nothing, its just an example...
Message was edited by:
Adam Pyschny
2007 Aug 14 1:30 PM
Hi,
Try this way,
DATA: stueckliste ...
DATA: wastueckliste ...
DATA: fieldcat ...
DATA: wa_fieldcat ...
FIELD-SYMBOLS <field> TYPE ANY.
LOOP AT stueckliste INTO wastueckliste.
LOOP AT fieldcat INTO wa_fieldcat.
item-item_name = wa_fieldcat-fieldname.
" Here you are moving the field 'matnr' of wastueckliste to a field-symbol
ASSIGN COMPONENT wa_fieldcat-fieldname
OF STRUCTURE wastueckliste TO <field>.
" IF ok, just use <field> as wastueckliste-matnr
IF sy-subrc IS INITIAL.
item-text = <field>.
ELSE.
" error
ENDIF.
ENDLOOP.
ENDLOOP.
<b>Don't forget to close this Thread and reward points when your question be answered.</b>
Regards.
Marcelo Ramos
2007 Aug 14 1:36 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |