Reputation: 3484
How can I put what a method - in this example get_properties
- is giving me into a local variable when the type of the parameter is ANY
?
"ES_ATTRIBUTES Exporting Type ANY
some_object->get_properties( IMPORTING es_attributes = ????? ).
I tried to put it into this variable, but that didn't work:
FIELD-SYMBOLS:
<ls_attributes> TYPE any.
Upvotes: 3
Views: 10496
Reputation: 5713
Actually as a caller, you should know the type you want to import for this ANY
parameter.
You have to know the protocol of GET_PROPERTIES
and debug it to know the return type of the parameter. In your method, you create a DATA REFERENCE
and have it assigned to a ANY
field symbol.
Data:
lr_data type ref to data.
Field-symbols:
<lt_properties> type any.
create data lr_data type TYPE_NAME. 'You should know the type
assign lr_data->* to <lt_properties>.
From my personal view, it is not a very good practice to define a method with EXPORTING
parameter type ANY
.
You either define a interface with IF_**_PROPERTY and you have a return TABLE of this interface.
or you return a name-value pair table. (From the method signature, it should return a TABLE, GET_PROPERTIES).
Upvotes: 0
Reputation: 13636
In ABAP, it means that you may use a data object of any type (the simplest way is to declare it with DATA
).
But it may be more restrictive according to the way the developer has coded his method.
Here, I recognize a method of WebUI Components (CRM, SOLMAN, …) so the data object must correspond to the "some_object
" you are accessing. Do a debug of GET_PROPERTIES if you are not sure.
Upvotes: 2