on 09-16-2014 1:30 PM
Hi,
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:
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.
Thibault
Hi,
In SKU Entity type, you provided navigation propeties name as NAVATP and NAVPRICING. Instead of that you can provide navigation propety name as Entity Types like ATP and PRICE.
I also have the same issue, when i changed the navigation property names with the Entity type names. it worked for me along with the header, able to get their line items as well.
Regards,
Venu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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".
Thanks
Hi,
as the NavAtp and NavPricing are child of NavMatnr, you need to try as below,
&$expand=NavMatnr/NavAtp,NavMatnr/NavPricing
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Chandra for this hint. &$expand=NavMatnr/NavAtp,NavMatnr/NavPricing works, because I don't get the error message anymore. But I don't get the requested data on the output.
When I debug the GET_EXPANDED_ENTITYSET, I can see that my output table is correctly populated with the data I requested. But the XML response only shows the parent level data NavMatnr.
Do you have any idea why this is happening ?
I think so. At the begening, I was inserting the navigation properties as follow:
ls_expanded_clause1 = 'NAVMATNR'.
ls_expanded_clause2 = 'NAVATP'.
ls_expanded_clause3 = 'NAVPRICING'.
APPEND ls_expanded_clause1 TO et_expanded_tech_clauses.
APPEND ls_expanded_clause2 TO et_expanded_tech_clauses.
APPEND ls_expanded_clause3 TO et_expanded_tech_clauses.
But since I got no results, I changed it to:
ls_expanded_clause1 = 'NAVMATNR'.
ls_expanded_clause2 = 'NAVMATNR/NAVATP'.
ls_expanded_clause3 = 'NAVMATNR/NAVPRICING'.
APPEND ls_expanded_clause1 TO et_expanded_tech_clauses.
APPEND ls_expanded_clause2 TO et_expanded_tech_clauses.
APPEND ls_expanded_clause3 TO et_expanded_tech_clauses.
Okay.
first try with below
ls_expanded_clause2 = 'NAVMATNR/NAVATP'.
ls_expanded_clause3 = 'NAVMATNR/NAVPRICING'.
APPEND ls_expanded_clause1 TO et_expanded_tech_clauses.
APPEND ls_expanded_clause2 TO et_expanded_tech_clauses.
if it will not work then try with below.
ls_expanded_clause = 'NAVMATNR/NAVATP,NAVMATNR/NAVPRICING'.
APPEND ls_expanded_clause TO et_expanded_tech_clauses.
and let me know the result.
Regards,
Chandra
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.