cancel
Showing results for 
Search instead for 
Did you mean: 

How to access MPC from DPC?

Former Member
0 Kudos

hello.

i want to access the MPC from the DPC methods, i.e. ..._GET_ENTITYSET(). How to retrieve the instance of te MPC connected to the current DPC?

background info:

i want to use the labels assigned to ABAP structure components of an entity type without hard.coding them...

cheers

--MIKE

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

here comes the solution:

* determine name of OData property assigned to ABAP field VBELN
   data:
     facade      type ref to /iwbep/cl_mgw_dp_facade,
     model       type ref to /iwbep/if_mgw_odata_re_model,
     entity_type type ref to /iwbep/if_mgw_odata_re_etype,
     properties  type /iwbep/if_mgw_odata_re_prop=>ty_t_mgw_odata_properties,
     name        type string.

   field-symbols:
     <property> type line of /iwbep/if_mgw_odata_re_prop=>ty_t_mgw_odata_properties.

   facade ?= me->/iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
   model = facade->/iwbep/if_mgw_dp_int_facade~get_model( ).

   entity_type = model->get_entity_type( |{ iv_entity_name }| ).
   properties = entity_type->get_properties( ).

   read table properties
     assigning <property>
     with table key technical_name = 'VBELN'.

   if sy-subrc eq 0.
     name = <property>-property->get_name( ).
   endif.

Former Member
0 Kudos

has anybody ever tried to retrieve the model instance /iwbep/if_mgw_odata_re_model while instantiation of the DPV? in my case it seems to create a dump....


i would like to retrieve the model in CONSTRUCTOR and store its reference in an instance attribute, so that all other methods can access it easily...

kammaje_cis
Active Contributor
0 Kudos

Mike,

What you require is model instance, not the MPC instance itself.

Here it is.