2011 Apr 19 3:45 AM
Hello,
I am trying to implementing a BADI, in its signature part,
c_accit TYPE REF TO data.
My pseudo code goes like,
DATA: l_itm_details TYPE REF TO data.
l_itm_details = c_accit.
l_itm_details-koart = 'D' =====> here am getting error!
* Do processing
ENDIF.
Here am getting error that, l_itm_details is not a structure! Pls. let me know how to fix it?
Thank you
2011 Apr 19 7:27 AM
Hello,
c_accit TYPE REF TO data.C_ACCIT is a "data reference" parameter. In order to access its components you have to "de-reference" it!
FIELD-SYMBOLS: <l_itm_details> TYPE ANY,
<l_value> TYPE ANY.
ASSIGN c_accit->* TO <l_itm_details>."De-reference the data reference
ASSIGN COMPONENT 'KOART' OF STRUCTURE <l_itm_details> TO <l_value>.If you know the structure of the data reference variable you can define your field-symbol <l_itm_details> of that type directly, else you can define a generic type as mentioned in the code snippet.
BR,
Suhas
Hello,
c_accit TYPE REF TO data.C_ACCIT is a "data reference" parameter. In order to access its components you have to "de-reference" it!
FIELD-SYMBOLS: <l_itm_details> TYPE ANY,
<l_value> TYPE ANY.
ASSIGN c_accit->* TO <l_itm_details>."De-reference the data reference
ASSIGN COMPONENT 'KOART' OF STRUCTURE <l_itm_details> TO <l_value>.If you know the structure of the data reference variable you can define your field-symbol <l_itm_details> of that type directly, else you can define a generic type as mentioned in the code snippet.
BR,
Suhas
2011 Apr 19 5:09 AM
Hi Raju,
I am not sure what this data is.i.e. class or structure.
I am assuming that it is a structure. In your code what you have done is only declared references but not created the instance.
Please try the below code it will resolve your problem.
DATA : c_accit TYPE REF TO data.
l_itm_details TYPE REF TO data.
CREATE DATA c_accit.
l_itm_details = c_accit.
l_itm_details->koart = 'D' .
Hope it will resolve your problem.
2011 Apr 19 7:27 AM
Hello,
c_accit TYPE REF TO data.C_ACCIT is a "data reference" parameter. In order to access its components you have to "de-reference" it!
FIELD-SYMBOLS: <l_itm_details> TYPE ANY,
<l_value> TYPE ANY.
ASSIGN c_accit->* TO <l_itm_details>."De-reference the data reference
ASSIGN COMPONENT 'KOART' OF STRUCTURE <l_itm_details> TO <l_value>.If you know the structure of the data reference variable you can define your field-symbol <l_itm_details> of that type directly, else you can define a generic type as mentioned in the code snippet.
BR,
Suhas
2011 Apr 20 6:17 PM
ASSIGN c_accit->* TO <l_itm_details>."De-reference the data reference Here pls. let me know,
1) What will do the symbol of
->* and how do we call it?
2) What does mean of 'De-reference'
Thank you.
2011 Apr 20 6:30 PM
You call '->*' just as Suhas explained. That symbol is called the de-referencing operator and it merely serves to give the field-symbol the value of the data object in the storage area. You can read more about it in the help files on ASSIGN. De-referencing' just means de-coding the value of a data reference.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |