Reputation: 170
The below code gives this error:
The inline declaration "DATA(LV_DESKTOP)" is not possible in this position.
CALL METHOD cl_gui_frontend_services=>get_desktop_directory
CHANGING
desktop_directory = data(lv_desktop). "Declaring in method
Upvotes: 2
Views: 2355
Reputation: 13629
You can't use an inline declaration with the parameters of type CHANGING
and EXPORTING
in method calls.
The ABAP documentation doesn't say it explicitly, but mentions explicitly that inline declaration can be used for parameters of type IMPORTING
and RECEIVING
, with some limitations, without saying anything about the two other types.
There was extensive discussions here and here.
Examples of possible inline declarations with method calls:
cl_gui_frontend_services=>FILE_GET_ATTRIBUTES
EXPORTING
filename = `C:\test.txt`
IMPORTING
readonly = DATA(readonly) ).
cl_ixml=>create(
RECEIVING
rval = DATA(ixml) ).
Concerning EXPORTING
or CHANGING
, you have to deal with the old declarations. Example:
DATA lv_desktop TYPE string.
cl_gui_frontend_services=>get_desktop_directory(
CHANGING
desktop_directory = lv_desktop ).
Upvotes: 7