cancel
Showing results for 
Search instead for 
Did you mean: 

Expand Features Across Different Services

jibin_joy
Contributor
0 Kudos

Hi experts,

   Need Help in Expand features across different services. The problem i am facing is briefly explained below  .

Procedues for external  Associaton

      There are two service ZRFC1 and ZATTACH1. Trying to use ZATTACH1 service in ZRFC1 service.

When calling following URL

http://XXXXXXXXXXX:8000/sap/opu/odata/sap/ZRFC1_SRV/Locations('BANGALORE')?$expand=links

Location Entity defined in ZRFC1

Customer Entity defined in ZATTACH1

  

Getting Error :

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<code>SY/530</code>

<message xml:lang="en">Entity by ID 'N4AF3BA6D2CC6E89281B0BE6A57044751' not found.</message>

<innererror>

<transactionid>CCC837E24D7FF104984978E3B5A070BA</transactionid>

<errordetails>

<errordetail>

<code>/IWBEP/CX_MGW_MED_EXCEPTION</code>

<message>Entity by ID 'N4AF3BA6D2CC6E89281B0BE6A57044751' not found.</message>

<propertyref />

<severity>error</severity>

</errordetail>

</errordetails>

</innererror>

</error>

Direct Call :

http://XXXXXXXXXXX:8000/sap/opu/odata/sap/ZRFC1_SRV/Locations('BANGALORE')/links

  this url is working fine i dont see any pblm in assoication .

My Assumption For Problem :

Call Stack

STEP 1 :
Class  : /IWBEP/CL_MGW_ABS_DATA
Method : /IWBEP/IF_MGW_CORE_SRV_RUNTIME~READ_ENTITY

.
.
.
.
.
  lo_model = me->get_model( ).
  lo_expand_tree->add_metadata(
    io_model = lo_model
  ).

   -> Here lo_model ref variable will ref to ZRFC1 service model information

STEP 2 :
Class  : /IWBEP/CL_MGW_EXPAND_NODE
Method :  ADD_METADATA
.
.
.
.
.
  LOOP AT lt_children REFERENCE INTO lr_child.
    lo_child_node = lr_child->*-node.
    lv_navigation_property = lr_child->*-nav_prop_name.
    lo_navigation_property = io_entity_type->get_navigation_property( lv_navigation_property ).
    lo_association         = lo_navigation_property->get_association( ).
    lo_association_set     = lo_association->get_association_set( ).
    lo_target_entity_type = lo_association->get_left_entity_type( ).
    IF lo_target_entity_type->get_name( ) EQ io_entity_type->get_name( ).
      lo_target_entity_type = lo_association->get_right_entity_type( ).

   -> trying  to get Left Entity information (Customer Entity which is defined in ZATTACH1 service)

STEP 3 :

Class  : /IWBEP/CL_MGW_ODATA_ASSOCIATN
Method : /IWBEP/IF_MGW_ODATA_FW_ASSOC~GET_RIGHT_ENTITY_TYPE
.
.
.
.
.
ro_right_entity_type = mo_model->get_entity_type_by_id( mr_association->*-target_entity_id ).

-> Getting Entity Type by id ( mr_association->*-target_entity_id contain value "Customer")

STEP 4:
class  : /IWBEP/CL_MGW_ODATA_MODEL
Method : GET_ENTITY_BY_ID


  data:
        lx_med type ref to /IWBEP/cx_mgw_med_exception,
        lr_entity type ref to /IWBEP/IF_MGW_MED_ODATA_TYPES=>ty_s_med_entity_type.

  Read Table mt_entities Reference Into rr_entity_type With Key entity_id = iv_entity_id.
  if sy-subrc ne 0.
    create object lx_med
      EXPORTING
        TEXTID = /IWBEP/cx_mgw_med_exception=>entity_id_not_found
        entity_id = iv_entity_id
        .
    handle_exception( lx_med ).
   Endif.

-->  mt_entities  is an attribute in model ref which is mentioned in step1 . mt_entities contain entities information of ZRFC1 service.now iv_entity_id = 'Customer' which is passed in step 3.

    Now in above code , in  read statement Customer entity is seached in mt_entities collection

The problem comes here mt_entites contain all entities of ZRFC1 service and code is trying to fetch Customer entity of another service   ZATTACH1 service

becuase of this subrc will be 4 which rasie  exception .

Need ur Valuable suggestion to overcome this  problem.

Thanks in Adavnce

Regards,

Jibin Joy

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jibin,

Any luck with this problem? I am experiencing the same issue.

Thank you !