on 11-30-2015 7:59 AM
We are trying to create an entity with associations as below:
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashwin
Please find below the details requested:
Cardinality
Association Referential Constraints
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.
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
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.