12-16-2015 12:23 PM
Hi guru, i have a problem.
I have to call a method which uses a parameter type data.
FIELD-SYMBOLS <fs_data> TYPE data.
CALL METHOD me->get_entity_data
EXPORTING
io_access = io_access
CHANGING
cs_data = <fs_data>. <---This parameter is defined type data
I tryed to use field symbol type data but it dumps because the field simbol is not assigned.
If i use instead a type ref to data the method dumps because the field symbol has a different type.
DATA lr_data TYPE REF TO data.
CREATE data lr_data TYPE REF TO data.
ASSIGN lr_data->* TO <fs_data>.
How to solve it?
thank you
12-16-2015 10:25 PM
Hi Pierfabio,
if you want to have access to a particular field content using the OVS interface just remember on old ABAP WD times,where the context nodes were not covered by FPM interface methods. So try this:
io_ovs_callback->context_element->get_attribute(
EXPORTING
name = 'YOUR_FIELD_NAME'
IMPORTING
value = lv_your_field_with_known_ddic_type
).
You can find the DDIC structure used for your form in method IF_FPM_GUIBB_FORM~GET_DEFINITION.
Good luck with FPM.
Attila
12-16-2015 1:17 PM
Hi,
If the data is created inside the method, you could just pass the data reference directly to the method.
CALL METHOD me->get_entity_data
EXPORTING
io_access = io_access
IMPORTING
cs_data = lr_data.
12-16-2015 1:32 PM
CREATE data lr_data TYPE <type>. <-- i don't have a defined type
indeed when i check it gives:
Type "<TYPE>" is unknown |
12-16-2015 1:38 PM
DATA lr_data TYPE REF TO data.
CALL METHOD me->get_entity_data
EXPORTING
io_access = io_access
CHANGING
cs_data = lr_data.
ERROR: Invalid operand type in MOVE-CORRESPONDING statement. (termination: RABAX_STATE)
12-16-2015 1:38 PM
Hi Peirfabio,
Can you try out using APPEND INITIAL LINE TO and CREATE OBJECT and then try calling Method.
Regards,
Kiran
12-16-2015 1:39 PM
12-16-2015 1:55 PM
12-16-2015 2:39 PM
Is your method parameter type data or type ref to data?.
I have a similar situation where I need to pass to a specific instance of an Object structured data... This data can be a lots of things... This is how I solved it.
When I call the method:
* gs_data is a global structure of unknown type
* gr_data is a reference to data (type ref to data)
get reference of gs_data into gr_data.
gr_view->put_screen_data( gr_data ).
inside of method put_screen_data (my parameter is TYPE REF TO DATA):
data: scr_data type ref to data.
field-symbols: <data>
type any.
get reference of i_data into scr_data.
assign scr_data->* to <data>.
This way I can pass an unknown data type to a method. In that method I need to know what to expect and what to do with it... Field-Symbol <data> contains a reference to gs_data. Then one must deref <data> to access its content, something like:
assing <data>->* to <local_fieldsymbol>.
Hope it helps!
Carlos
12-16-2015 3:54 PM
Dear Carlos,
get reference of i_data into scr_data. "<-- I_data is declared type data??
12-16-2015 3:58 PM
I_data is my method importing parameter. Is declared as type ref to data.
Sorry It wasn't clear in my response.
Cheers,
Carlos
12-16-2015 4:14 PM
Carlos the problem is that i must call this Method:
CALL METHOD me->get_entity_data
EXPORTING
io_access = io_access
CHANGING
cs_data = <my_data>.
cs_data is defined type data.
my_data must be a field-symbol because it's type data.
If i declare: field-symbols <my_data> type data, when i call the method it dumps because the field-symbol is not yet assigned.
If i declare:
DATA lr_data TYPE REF TO data.
CREATE data lr_data TYPE REF TO data.
ASSIGN lr_data->* TO <my_data>.
and then call method, it dumps becouse <my_data> is type ref to data.
I must instanciate the field symbol to allow the correct calling of method.
12-16-2015 4:35 PM
Is your goal to receive data without knowing what it is? That seems very awkward...
Take a look on what Jörg Wulf wrote. I am with him. You must know what kind of data you are expecting.
Cheers
12-16-2015 4:19 PM
Hi Pierfabio,
a Parameter of type data means, you can pass any data to it. It is a generic data type, used mostly, when either the exact type does not matter, or ist identified within the method.
Passing a field-Symbol of type data, WITHOUT assigning it priour, will not work.
The method obviously is intended to fill the variable passed by Parameter cs_data.
When you call that method, you should have an idea as to what kind of data you want to get back.
So just pass the receiving variable, without worrying about datatype data. The method will most certainly take care of it, as long as the variable can handle the type of data you expect to
retrieve.
In most cases, a method using this type of generic parameter, will issue another importing Parameter that would specify the value to retrieve in Textform like
iv_name = 'FIELD_THAT_I_NEED'
In case you don't get any further, consider to let us know a bit more of the context in which you use that method and which class it belongs to.
Best regards - Jörg
12-16-2015 4:54 PM
Dear guys, my previous problem is that i'm in a class:
ZCL_MDG_GUIBB_FI_ACCOUNT Inherited from CL_MDG_GUIBB_FI_ACCOUNT.
I have redefined the method OVS_HANDLE_PHASE_2.
I have to read the values of fields filled on line becouse from this value i have to delete some
value of table ER_OUTPUT.
I posted another issue how to read the values of fields filled on line in FPM GUIBB form.
Since i haven't erceived an answer, I tryed to use then the method get_entity_data to get the value in CS_DATA.
In Abap, i used to read values on line the function module DYNP_VALUES_READ but in FPM i don't know how to read these values.
12-16-2015 4:34 PM
12-16-2015 10:25 PM
Hi Pierfabio,
if you want to have access to a particular field content using the OVS interface just remember on old ABAP WD times,where the context nodes were not covered by FPM interface methods. So try this:
io_ovs_callback->context_element->get_attribute(
EXPORTING
name = 'YOUR_FIELD_NAME'
IMPORTING
value = lv_your_field_with_known_ddic_type
).
You can find the DDIC structure used for your form in method IF_FPM_GUIBB_FORM~GET_DEFINITION.
Good luck with FPM.
Attila
12-17-2015 4:50 PM
Attila thank you, could you tell me ho instantiate io_ovs_callback ?
In OVS_HANDLE_PHASE_2 i have to instantiate io_ovs_callback
12-17-2015 7:58 PM
If the method IF_FPM_GUIBB_OVS~HANDLE_PHASE_2 what you've redefined is called by FPM framework, and you're able to debug it, then it must have the importing parameter io_ovs_callback instanciated by the FPM framework. If your method is not called by FPM, then you need first setup the field description (for which you want to execute the OVS), to call your Z-class instead of the standard. Here is the corresponding point of the FPM developer guide on page 226:
For search GUIBBs, you have a separated interface, page 192.
You cannot call explicitly FPM interface methods in your own coding, this is done by the framework always, managing the data from and to the UI, where you can do your changes, and react on events.
Look at the developer guide of the GUIBB interfaces IF_FPM_GUIBB_*, and IF_FPM_GUIBB_OVS*.
12-18-2015 10:25 AM
12-18-2015 12:20 PM
Hi Pierfabio,
if my answer was helpful, please set it as helpful .
Thanks
Best regards
Mr. PointHunter
12-18-2015 2:12 PM