cancel
Showing results for 
Search instead for 
Did you mean: 

Resource not found for the segment

Former Member

Hi
In Gateway, I want to get header and item data of my PO from ERP, on behalf of the PO number.

In transaction /IWFND/GW_CLIENT I execute the http method GET for

/sap/opu/odata/sap/ZGW_BD_PURCH_SRV/

and
/sap/opu/odata/sap/ZGW_BD_PURCH_SRV/$metadata

I got a http status 200 return – which is fine 


In the ERP that I am calling, there is a purchase order with no. '3000000006'

But when I execute the service for following url: /sap/opu/odata/sap/ZGW_BD_PURCH_SRV/PurchaseOrderCollection('3000000006')

But I got this error:

<?xml version="1.0" encoding="utf-8" ?>

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<code>005056A509B11ED199D891D139C92103</code>

<message xml:lang="en">Resource not found for the segment 'PurchaseOrderCollection('3000000006')'.</message>

</error>

 

My settings are like this:
Entity types is created:
PurchaseOrders (PoNumber is key) + PurchaseOrdersItems (PoNumber+PoItem are keys)

Entity Sets is created:
PurchaseOrderCollection (assigned to PurchaseOrders) + Purchaseorderitem (assigned to PurchaseOrdersItems)

In the Service Implementation the PurchaseOrderCollection has following mappings:

And for Purchaseorderitem I have following mappings:

The only BAPI that we are using is: BAPI_PO_GETITEMS

Any ideas?

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

I just ran into this issue and thought I would share in case anyone else runs into this in the future. If you go transaction /IWFND/MAINT_SERVICE, select your service, and click the LOAD METADATA and REFRESH CATALOG button, it should correct this issue.

Answers (2)

Answers (2)

jibin_joy
Contributor
0 Kudos

Hi ,

  can post me the error detail found in /IWFND/ERROR_LOG TCode

Regards,

Jibin Joy

Former Member
0 Kudos

Hi
Here is the log:

.ERROR_CONTEXT

..ERROR_INFO Resource PurchaseOrderCollection not defined in Metadata

../IWFND/CX_SODATA_EDM_PROVIDER

...ENTITY_CONTAINER

...ENTITY_TYPE

...COMPLEX_TYPE

...ASSOCIATION

...ENTITY_SET

...ASSOCIATION_SET

...FUNCTION_IMPORT

...MODEL_ID

...RESOURCE PurchaseOrderCollection

..SERVICE_INFO

...NAMESPACE /SAP/

...VERSION 0001

...SERVICE_NAME ***Hide_due_to_secure_log_level***

...REQUEST_DIRECTION Consumer to Gateway

...AGENT OData Lib 1.0 Handler

..SYSTEM_INFO

...REQUEST_ID DF4E10A820B91EE2ACDE8B69A256A09E

...REQUEST_URI /sap/opu/odata/sap/***Hide_due_to_secure_log_level***

...REMOTE_ADDRESS <IP ADDRESS IS REMOVED HERE>

...APPLICATION_SERVER gw_GW1_00

jibin_joy
Contributor
0 Kudos

Hi,

  Goto TCODE - /IWFND/CACHE_CLEANUP clean up the cache .

If still error coming can u post ur metdata document .

Regards,

Jibin Joy

Former Member
0 Kudos

I still have problems after clearing the cache..
To be honorst, I am not sure if my setup is correct, but there is a connection between ERP and Gateway, and I could catch my BAPI via the remote function call in import datamodel (in tcode SEGW)

Here is the metadata from:
/sap/opu/odata/sap/ZGW_BD_PURCH_SRV/$metadata

  <?xml version="1.0" encoding="utf-8" ?>

- <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData">

- <edmx:DataServices m:DataServiceVersion="2.0">

- <Schema Namespace="ZGW_BD_PURCH_SRV" xml:lang="en" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">

- <EntityType Name="PurchaseOrders" sap:content-version="1">

- <Key>

  <PropertyRef Name="Vendor" />

  </Key>

  <Property Name="Vendor" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Vendor" sap:sortable="false" sap:filterable="false" />

  <Property Name="DeleteInd" Type="Edm.String" Nullable="false" MaxLength="1" sap:label="Deletion Indicator" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

  <Property Name="PoNumber" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Purchasing Document" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

  </EntityType>

- <EntityType Name="PurchaseOrdersItems" sap:content-version="1">

- <Key>

  <PropertyRef Name="PoItem" />

  <PropertyRef Name="PoNumber" />

  </Key>

  <Property Name="PoPrice" Type="Edm.String" Nullable="false" MaxLength="1" sap:label="Adopt price" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

  <Property Name="NetPrice" Type="Edm.Decimal" Nullable="false" Precision="23" Scale="4" sap:label="Net order price" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

  <Property Name="Plant" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Plant" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

  <Property Name="InfoRec" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Purchasing Info Rec." sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

  <Property Name="Material" Type="Edm.String" Nullable="false" MaxLength="18" sap:label="Material" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

  <Property Name="PoItem" Type="Edm.String" Nullable="false" MaxLength="5" sap:label="Item" sap:sortable="false" sap:filterable="false" />

  <Property Name="PoNumber" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Purchasing Document" sap:sortable="false" sap:filterable="false" />

  </EntityType>

- <EntityContainer Name="ZGW_BD_PURCH_SRV" m:IsDefaultEntityContainer="true">

  <EntitySet Name="PurchaseOrders" EntityType="ZGW_BD_PURCH_SRV.PurchaseOrders" sap:pageable="false" sap:addressable="false" sap:content-version="1" />

  <EntitySet Name="PurchaseOrderItems" EntityType="ZGW_BD_PURCH_SRV.PurchaseOrdersItems" sap:pageable="false" sap:addressable="false" sap:content-version="1" />

  </EntityContainer>

  <atom:link rel="self" href="http://gw.<OUR_DOMAIN>.biz:8000/sap/opu/odata/sap/ZGW_BD_PURCH_SRV/$metadata" xmlns:atom="http://www.w3.org/2005/Atom" />

  <atom:link rel="latest-version" href="http://gw.<OUR_DOMAIN>.biz:8000/sap/opu/odata/sap/ZGW_BD_PURCH_SRV/$metadata" xmlns:atom="http://www.w3.org/2005/Atom" />

  </Schema>

  </edmx:DataServices>

  </edmx:Edmx>

jibin_joy
Contributor
0 Kudos

Hi ,

  In metadata Document Entityset Name is PurchaseOrders not PurchaseOrderCollection which is shown in screen shot..... same for Item Level

  <EntitySet Name="PurchaseOrders" EntityType="ZGW_BD_PURCH_SRV.PurchaseOrders" sap:pageable="false" sap:addressable="false" sap:content-version="1" />

  <EntitySet Name="PurchaseOrderItems" EntityType="ZGW_BD_PURCH_SRV.PurchaseOrdersItems" sap:pageable="false" sap:addressable="false" sap:content-version="1" />

     Goto /IWFND/CACHE_CLEANUP

Check "the Cleanup Cache For All models"

then Re-generated the Project in SEGW

  I Think other things are fine

Regards,

Jibin Joy

Former Member
0 Kudos

I have added a change in the host file, so the ip and the webaddress is "known", so now I can get the webbrowser to open. 🙂

My issue now is "just" that I don't get any data from ERP into my call from gateway

jibin_joy
Contributor
0 Kudos

Hi ,

The Basic Flow to gateway is simple......

Outside World contact SAP Netweaver Gateway server . Try find out the ur service such as /sap/opu/odata/sap/ZGW_BD_PURCH_SRV/  then check the metadata document in cache If not found it will generate  new metadata document kept in the cache again . My advice is to deactivate Cache during development

Ref

-http://help.sap.com/saphelp_gateway20sp03/helpdata/en/3d/45e259b4bd49e197316cbfd3c7fa8e/content.htm

-http://mysapgw.wordpress.com/2012/01/17/metadata-cache-cleanup/

    Once it fetch the Metadata document . It does URL as well as body validation based on the metadata Document ...

When Everything is verified then only it will contact Backend .

Now ur issue is that the flow stop in  URL validation because it is not able to find the resource mentioned in url  "PurchaseOrderCollection"  but in the metadata Entity set name is "PurchaseOrders".

The problem i see is in Caching


Solution

1. Deactivate Cache as mentioned in above ref

2. Goto /IWFND/CACHE_CLEANUP

Check "the Cleanup Cache For All models"

then Re-generated the Project in SEGW

  if still not work then try to make new service ..

Regards,

Jibin Joy

0 Kudos

Thanks Jibin, I have been facing this problem and clearing cache solved the issue.

Former Member
0 Kudos

Hi,

This error usually happens when the entity set being called in not correct.

Example.

My entity set has the name YstProdData and my call is:

/sap/opu/odata/sap/ZPRODUCTS_TABLES_SRV_01/YstProdData(11)

The result is perfect with all the info. However if I call:

/sap/opu/odata/sap/ZPRODUCTS_TABLES_SRV_01/YtaProdData(11)

/sap/opu/odata/sap/ZPRODUCTS_TABLES_SRV_01/YProdData(11)

/sap/opu/odata/sap/ZPRODUCTS_TABLES_SRV_01/whatever(11)

the result is always: "Resource not found for the segment 'whatever(11)'"

Could you post screenshot of the list of entity sets.

Regards

Former Member
0 Kudos

Maybe the calling is incorrect, but do you (or others) have a chance to see if my mapping is incorrect. Screen dumps above.
I will really appreciate that

Former Member
0 Kudos

Hi,

I can't see your entity sets in your screenshots. At least not very well.

Post screenshot of the project in SEGW with clear vision of entity sets.

Regards

Former Member
0 Kudos

Sorry - you are right.

Here it is:

Former Member
0 Kudos

HI,

I guess generation was succesfully right?

Provide metada result.

You should stop debugging in the class  "*NAME*DPC class method GET_ENTITY. Doy you see your entity set in the method?

There you should see how the entity set is selected and how the read operation start.

Regards

Former Member
0 Kudos

There is code in my method PURCHASEORDERCOL_GET_ENTITY

I have tried to set break-points (session breakpoint and external breakpoint), but i don't get into my breakpoints.

Former Member
0 Kudos

Could it be some settings in transaction /IWFND/MAINT_SERVICE?

When I choose the path to ZGW_BD_PURCH_SRV, and rightclick on the service, I can see that the service is active - but when I press "test service" I got the message in Internet Explorer, that the page can't be shown.

Any ideas?