cancel
Showing results for 
Search instead for 
Did you mean: 

Error with $expand and navigation: Resource not found for the segment 'NavAtp'

Former Member
0 Kudos

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:

  • 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:


DATABEGIN 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.

   DATABEGIN 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

Accepted Solutions (1)

Accepted Solutions (1)

former_member206574
Active Participant
0 Kudos

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

Former Member
0 Kudos

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

ChandraMahajan
Active Contributor
0 Kudos

Can you please let us know which combination is working for et_expanded_tech_clauses?

Former Member
0 Kudos

Hello Chandra,

Concerning the et_expanded_tech_clauses, the following code is working:

APPEND 'NAVMATNR/NAVATP' TO et_expanded_tech_clauses.

APPEND 'NAVMATNR/NAVPRICING' TO et_expanded_tech_clauses.

The use of the navigation property works well on my side.

Thibault

ChandraMahajan
Active Contributor
0 Kudos

Thanks. that's what I also believe the correct code. So the rule is comma separated child hierarchies need to be inserted into et_expanded_tech_clauses

Regards,

Chandra

Pavan_Golesar
Active Participant
0 Kudos

Thanks , Its useful info..

Regards,

Pavan G

Answers (1)

Answers (1)

ChandraMahajan
Active Contributor

Hi,

as the NavAtp and NavPricing are child of NavMatnr, you need to try as below,

&$expand=NavMatnr/NavAtp,NavMatnr/NavPricing


Regards,

Chandra

Former Member
0 Kudos

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 ?

ChandraMahajan
Active Contributor
0 Kudos

Are you inserting navigation property into et_expanded_tech_clauses?

Let me know how are you filling it.

Regards,

Chandra

Former Member
0 Kudos

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.

ChandraMahajan
Active Contributor
0 Kudos

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

Former Member
0 Kudos

The result is the same with both solutions...

ChandraMahajan
Active Contributor
0 Kudos

As per this thread the OP got it working with obsolete parameter ET_EXPANDED_CLAUSES. may be you can try with that option. Not sure if it will work.

Varamanoj
Participant
0 Kudos

Can you please Share what was the reason.. I am also facing the same issue.. I can see the header data but nothing in my details...