cancel
Showing results for 
Search instead for 
Did you mean: 

Problem passing data from object class to DPC_EXT

Former Member
0 Kudos

Hello,


In DPC_EXT i am calling like this:

create:

      object lo_ConfirmationHeader,

      data er_entity type ZCL_ZQM_CONF_MPC_EXT=>S_ConfirmationHeader.

lo_ConfirmationHeader->/iwbep/if_mgw_appl_srv_runtime~get_entity(

exporting iv_entity_name = iv_entity_name

iv_source_name = iv_source_name

iv_entity_set_name = iv_entity_set_name

it_navigation_path = it_navigation_path

it_key_tab = it_key_tab

IO_TECH_REQUEST_CONTEXT = IO_TECH_REQUEST_CONTEXT

importing er_entity = er_entity ).

then in object class there is:

  create data er_entity type ZCL_ZQM_CONF_MPC_EXT=>S_ConfirmationHeader.

  assign er_entity->* to <fs_ConfirmationHeader>.

*** here i am getting data

** and after line:

ASSIGN ls_ConfirmationHeader to <fs_ConfirmationHeader>.

**<fs_ConfirmationHeader> contain data

but after back to DPC_EXT

there is no this data in er_entity

Thanks

Lucas

Accepted Solutions (0)

Answers (2)

Answers (2)

AshwinDutt
Active Contributor
0 Kudos

Hello Lukasz,

When i say its not GW issue its just that GW frame is not generated code here.

its our manual code which is to be written correctly so that we persist data and send back response to GW.

Try as below and check once.

Inside the object class capture ur data in a structure as below ->


declare,


ls_confirm_hdr  type ZCL_ZQM_CONF_MPC_EXT=>S_ConfirmationHeader.


Populate data into structure ls_confirm_hdr.

Then return  ls_confirm_hdr to er_entity where er_entity is of type ZCL_ZQM_CONF_MPC_EXT=>S_ConfirmationHeader only


i.e., data : er_entity type ZCL_ZQM_CONF_MPC_EXT=>S_ConfirmationHeader


Inside DPC_EXT class


declare as below ->


DATA ls_entity TYPE REF TO data.

FIELD-SYMBOLS: <ls_data> TYPE any.


" call ur logic

" sample code


lo_ConfirmationHeader->/iwbep/if_mgw_appl_srv_runtime~get_entity(

exporting iv_entity_name = iv_entity_name

iv_source_name = iv_source_name

iv_entity_set_name = iv_entity_set_name

it_navigation_path = it_navigation_path

it_key_tab = it_key_tab

IO_TECH_REQUEST_CONTEXT = IO_TECH_REQUEST_CONTEXT

importing er_entity = ls_entity ).


ASSIGN ls_entity->* TO <ls_data>.

   er_entity = <ls_data>.


Now inside ur DPC_EXT class, er_entity will have the data u sent from the object class.


I mean to say , In short u need to have as below


er_entity -> type of type ZCL_ZQM_CONF_MPC_EXT=>S_ConfirmationHeader

ls_entity -> TYPE REF TO data


Regards,

Ashwin



AshwinDutt
Active Contributor
0 Kudos

Hello Lukasz,

According to me there is something which is missing in the code level and hence data is not present.

I don't see any GW issue here.I feel u need to look into the code which is written manually.

What are u trying to perform here ?

READ ? or READ after Create operation ?

Sharing some more details may help.

Regards,

Ashwin

Former Member
0 Kudos

Its READ - get_entity impementation.

its GW issue cause GW framework require to pass data like this i guess

Former Member
0 Kudos

Lukasz,

This doesn't look right. You shouldn't be needing to write code like this.

This is the code for the generic GET_ENTITY handler, you don't need to alter that - its job is to direct the request to the discrete handling logic for a particular entity.

All you need to do is redefine the method <my_entity>_GET_ENTITYin the DPC_EXT and fill the ER_ENTITY return, which is already typed to match the entity definition.

No dynamic data or FS assignments needed!

Should not be any more complex than this example:

method allwidgets_get_entity

.

data: lt_keytab type /iwbep/t_mgw_tech_pairs, ls_keytab type /iwbep/s_mgw_tech_pair.

data: lv_equnr type equnr.

   lt_keytab = io_tech_request_context->get_keys( ).

   if lt_keytab is not initial.

     read table lt_keytab into ls_keytab with key name = 'WIDGETID'.

     if sy-subrc = 0.

       lv_equnr = ls_keytab-value.

       call function 'CONVERSION_EXIT_ALPHA_INPUT'

         exporting

           input  = lv_equnr

         importing

           output = lv_equnr.

       select single * from zgw_widget into er_entity where widgetid = lv_equnr.

     endif.

   endif.

endmethod.


Regards


Ron.