Error with $expand and navigation: Resource not found for the segment 'NavAtp'
I have created associations between entities in order to get the following structure:
The first level is the material level. Then I have the SKU in second level which acts as a table because one material can have several SKUs.
Then, for each SKU, I have a table for stocks (ATP: immediate stock, stock in x days…) and prices: retail price and Wholesales price.
Here is a screenshot of what I have:
Concerning the navigations, I have:
- NavMatnr to relate the material level and the SKU level
- NavAtp to relate the ATP level to the SKU level
- NavPricing to relate the pricing level and the SKU level
I am calling the service using the following URL:
/sap/opu/odata/sap/zezb_get_materials_srv/Materials?$filter=SalesOrg eq 'GI10' and DistribChannel eq '01' and Division eq '30'&$expand=NavMatnr,NavAtp,NavPricing
The error triggered is the following: “Resource not found for the segment 'NavAtp'.”
I declare my deep structures as follow:
DATA: BEGIN OF ls_material_sku.
INCLUDE TYPE zcl_ezb_get_materials_mpc=>ts_sku.
DATA: navatp TYPE STANDARD TABLE OF zcl_ezb_get_materials_mpc=>ts_atp WITH DEFAULT KEY.
DATA: navpricing TYPE STANDARD TABLE OF zcl_ezb_get_materials_mpc=>ts_price WITH DEFAULT KEY,
END OF ls_material_sku.
DATA: BEGIN OF ls_output_material.
INCLUDE TYPE zcl_ezb_get_materials_mpc=>ts_material.
DATA: lt_material_output_sku LIKE STANDARD TABLE OF ls_material_sku.
DATA: navmatnr TYPE STANDARD TABLE OF zcl_ezb_get_materials_mpc=>ts_sku WITH DEFAULT KEY,
END OF ls_output_material.
I can understand that navatp is not part of the ls_output_material. But I need to get the navatp in the material sku structure, and not in the top parent structure. What should I do to resolve this issue ?
Thanks in advance for your help.
Thank you Venu for your help. Unfortunately it did not change anything.
I made some further research on my problem and found several SAP Notes to implement concerning initial inlines when using the $expand function.
Moreover, I found an important bug while debugging my coding that was misrecording the data in the wrong structure. Now I am able to get all my data with the nested "tables".