2011 Dec 02 1:47 PM
Hello community,
I have a more general question.
In a method I get a parameter that is of type 'TYPE REF TO DATA'.
In this object, there is a list of fieldnames and its values (name-value-pair).
When I debug I see the name and the values.
I implemented following to access the data:
" Define local structure
TYPES:
BEGIN OF S_VALUE_PAIR,
NAME TYPE ANY,
VALUE TYPE ANY,
END OF S_VALUE_PAIR.
" Define local table type
TYPES T_VALUE_PAIR TYPE S_VALUE_PAIR.
FIELD-SYMBOLS <fs_value_pair> TYPE T_VALUE_PAIR.
" (!!) Type conflict
ASSIGN IS_DATA TO <fs_value_pair>.The problem is, that the structure if the data in the parameter is unknown or dynamically created.
So how can I access the data in this case?
Thank you and BR, Christian
2011 Dec 02 3:17 PM
Hello community,
I have a more general question.
In a method I get a parameter that is of type 'TYPE REF TO DATA'.
In this object, there is a list of fieldnames and its values (name-value-pair).
When I debug I see the name and the values.
I implemented following to access the data:
" Define local structure
TYPES:
BEGIN OF S_VALUE_PAIR,
NAME TYPE ANY,
VALUE TYPE ANY,
END OF S_VALUE_PAIR.
" Define local table type
TYPES T_VALUE_PAIR TYPE S_VALUE_PAIR.
FIELD-SYMBOLS <fs_value_pair> TYPE T_VALUE_PAIR.
" (!!) Type conflict
ASSIGN IS_DATA TO <fs_value_pair>.The problem is, that the structure if the data in the parameter is unknown or dynamically created.
So how can I access the data in this case?
Thank you and BR, Christian
2011 Dec 02 2:05 PM
Can you try this statement.
ASSIGN is_data->* TO <fs_value_pair>.
2011 Dec 05 9:40 AM
Hallo Antony,
thank you for your reply. I have tried it but brings me the same error.
"Type conflict with ASSIGN in program ZCL_HRESS_PER_DETAIL_ADDR_AT==CP "
BR, Christian
2011 Dec 02 3:17 PM
2011 Dec 05 9:44 AM
Hello David,
how do you mean this? Something like this:
" Define local structure
TYPES:
BEGIN OF S_VALUE_PAIR,
NAME TYPE string,
VALUE TYPE string,
END OF S_VALUE_PAIR.
" Define local table type
TYPES T_VALUE_PAIR TYPE S_VALUE_PAIR.
" Here I didn't define a TYPE --> but in OO Context, this is not allowed
FIELD-SYMBOLS <fs_value_pair>. "TYPE T_VALUE_PAIR.
" (!!) Type conflict
ASSIGN IS_DATA->* TO <fs_value_pair>.Brings me the debugger-msg: "Untypisierte Feldsymbole werden im OO- Kontext nicht unterstützt." --> fieldsymbols with no type are not allowed in OO-Context
BR, Christian
2011 Dec 05 10:09 AM
Hi,
Just declare as
FIELD-SYMBOLS <fs_value_pair> type any
or as
FIELD-SYMBOLS <fs_value_pair> type table
2011 Dec 06 9:25 AM
hi,
I had a short call with Christian, now here's a working solution:
FIELD-SYMBOLS <ls_data> TYPE DATA.
FIELD-SYMBOLS <lv_field> TYPE fieldtype.
ASSIGN is_data->* to <ls_data>. "dereference into field symbol
ASSIGN COMPONENT 'FIELDNAME' OF STRUCTURE <ls_data> TO <lv_field>.
"error handling might be useful if component FIELDNAME is not available
BTW, this was in an FPM form feeder class. Hope this helps.
Regards
Ole
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |