cancel
Showing results for 
Search instead for 
Did you mean: 

The in-lines of the navigation property at second level is coming as initial after XML transformation in backend system ?

Former Member
0 Kudos

We are trying to create an entity with associations as below:

  1. Open Order KPI (Key: KPI ID, Navigation Property: NavToDate)
    • Orders aggregated by Date (Key: KPI ID and Date, Navigation Property: NavToOrders)
      • Orders for the Given Date (Key: KPI ID, Date and Order No.)

We have implemented the get deep entity method in the extension for data provider class of the entity to return data for both navigation properties.

URL: /sap/opu/odata/sap/Z_3M_UX_OTC_SRV/OrderSet?$format=json&$expand=NavToDate/NavToOrders

The get deep entity set method is working fine and it is fetching and populating both navigation properties, but in the XML transformation method the in-lines of NavToOrders association are getting refreshed and changed to initial values.

All related SAP notes for this issue are implemented in the back end system. Still we are facing the issue of in-lines being initial, please advice on how to correct the same.

Accepted Solutions (0)

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Rahul,

What is the cardinality defined between the entities in your case ? can you share here ? also can you share the Association defined between the entities ?

What is the Deep Structure declared inside Expand Entity method ? can you please share ?

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin

Please find below the details requested:

Cardinality

  • Order KPI to Orders Per Date: 0:M --> (0:1::0:N)
  • Order Per Date to Orders: 0:M --> (0:1::0:N)


Association Referential Constraints


  • Order KPI to Orders Per Date:  Unique ID
  • Order Per Date to Orders: Unique ID and Date

Deep Structure Declaration in Expanded Entity

// Order to Date and Order

        DATA:

           BEGIN OF ts_orderdate.

                 INCLUDE  TYPE zcl_ux_otc_v1_mpc=>ts_owdaudat.

                 DATA: navtorders TYPE zcl_ux_otc_v1_mpc=>tt_orderwithdelivery,

               END OF ts_orderdate.


// Orders KPI and structure declared above

         DATA:

           BEGIN OF ts_expand_so.

                 INCLUDE  TYPE zcl_ux_otc_v1_mpc=>ts_order.

                 DATA: navtodate LIKE TABLE OF ts_orderdate,

               END OF ts_expand_so .


         DATA: lt_expand_so LIKE TABLE OF ts_expand_so,

                    ls_expand_so LIKE          ts_expand_so

Please note that the er_entity at end of expanded entity set is populated correctly, we are having the lines initialized in the standard code for XML transformation after execution of this method.

AshwinDutt
Active Contributor
0 Kudos

I would model GW service as below ->

Create 3 entities ->

OrderKPI

OrderDate

OrderNo

Association  ->

OrderKPI to OrderDate with cardinality  1 to N

OrderDate to OrderNo with cardinality 1 to N


Navigation ->


NavToDate between OrderKPI & OrderDate


NavToOrders between OrderDate & OrderNo


Implement Expand_Entity_Set ->


" Deep structure & table


data: BEGIN OF ls_order.
INCLUDE TYPE ZCL_ZGW_MPC=>ls_OrderDate.
data: NavToOrders TYPE TABLE OF ZCL_ZGW_MPC=>ls_order_num WITH DEFAULT  KEY,
END OF ls_order.

data: BEGIN OF ls_data.
INCLUDE TYPE ZCL_ZGW_MPC=>ls_order_kpi.
data: NavToDate like TABLE OF ls_order WITH DEFAULT KEY,
end of ls_data.


data: lt_data like table of ls_data.


" Append the navigation properties


append 'NAVTODATE/NAVTOORDERS' to ET_EXPANDED_TECH_CLAUSES.


" fill the final table lt_data with all details and send back


   COPY_DATA_TO_REF(
exporting
IS_DATA = LT_DATA
changing
CR_DATA = ER_ENTITYSET
).

This should work. Please try as below.

Regards,

Ashwin

Former Member
0 Kudos

Hi Ashwin

I tried this approach, but still not getting the output for second level in lines in deep entity.

Will try to create project from scratch and try, please let me know if you find anything else on this.

AshwinDutt
Active Contributor
0 Kudos

Hello Rahul,

Not sure why its now working for you. Please check again.

This kind of modelling has worked for me in many cases.

Regards,

Ashwin