cancel
Showing results for 
Search instead for 
Did you mean: 

Error in using key predicates

nitesh_jain3
Active Participant
0 Kudos

Hi all,

When executing the service URL with key predicates i am getting an error raised by exception /IWBEP/CX_MGW_TECH_EXCEPTION (message Internal error occurred, contact your system.).

The Associations, Referential constraints and Navigation properties have been maintained correctly.

The key predicates being passed are:

Airlineid='AA',Connectid='0017',Flightdate=datetime'2013-09-04T00:00:00'

The complete URL looks like:

http://<host>:<port>/sap/opu/odata/SAP/FLIGHTLISTDCR/FlightLists(Airlineid='AA',Connectid='0017',Fli... where FlightLists is the name of the Entity set and FlightDetail is the name of the Navigation property. Without the key predicates the entity set  returns the desired result.

Metadata

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

- <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"

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

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

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

- <Key>

<PropertyRef Name="Airlineid" />

<PropertyRef Name="Connectid" />

<PropertyRef Name="Flightdate" />

</Key>

<Property Name="Flighttime" Type="Edm.Int32" Nullable="false" sap:label="Flight time" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Distance" Type="Edm.Decimal" Nullable="false" Precision="9" Scale="4" sap:label="Distance"
sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="CurrIso" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="ISO code" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Econofree" Type="Edm.Int32" Nullable="false" sap:label="Free seats" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Businfree" Type="Edm.Int32" Nullable="false" sap:label="Free seats" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Firstfree" Type="Edm.Int32" Nullable="false" sap:label="Free seats" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Curr" Type="Edm.String" Nullable="false" MaxLength="5" sap:label="Airline local currency" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Airlineid" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Airline" sap:sortable="false"
sap:filterable="false" />

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

<Property Name="Connectid" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Connection Number" sap:sortable="false" sap:filterable="false" />

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

<Property Name="Flightdate" Type="Edm.DateTime" Nullable="false" sap:label="Flight Date" sap:sortable="false" sap:filterable="false" />

<Property Name="Airportfr" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Departure airport" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Cityfrom" Type="Edm.String" Nullable="false" MaxLength="20" sap:label="Depart. city" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Arrdate" Type="Edm.DateTime" Nullable="false" sap:label="Arrival date" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Airportto" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Destination airport" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Cityto" Type="Edm.String" Nullable="false" MaxLength="20" sap:label="Arrival city" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Deptime" Type="Edm.Time" Nullable="false" sap:label="Departure time" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Arrtime" Type="Edm.Time" Nullable="false" sap:label="Arrival Time" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

</EntityType>

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

- <Key>

<PropertyRef Name="Flightdate" />

<PropertyRef Name="Connectid" />

<PropertyRef Name="Airlineid" />

</Key>

<Property Name="Airportto" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Destination airport" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Cityfrom" Type="Edm.String" Nullable="false" MaxLength="20" sap:label="Depart. city" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Airportfr" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Departure airport" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Flightdate" Type="Edm.DateTime" Nullable="false" sap:label="Flight Date" sap:sortable="false" sap:filterable="false" />

<Property Name="Connectid" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Connection Number" sap:sortable="false" sap:filterable="false" />

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

<Property Name="Airlineid" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Airline" sap:sortable="false"
    sap:filterable="false" />

<Property Name="Cityto" Type="Edm.String" Nullable="false" MaxLength="20" sap:label="Arrival city" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Deptime" Type="Edm.Time" Nullable="false" sap:label="Departure time" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Arrtime" Type="Edm.Time" Nullable="false" sap:label="Arrival Time" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="Arrdate" Type="Edm.DateTime" Nullable="false" sap:label="Arrival date" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

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

<Property Name="Curr" Type="Edm.String" Nullable="false" MaxLength="5" sap:label="Airline local currency" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<Property Name="CurrIso" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="ISO code" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false" />

<NavigationProperty Name="FlightDetail" Relationship="FLIGHTLISTDCR.FlightListFlightDetail"
FromRole="FromRole_FlightListFlightDetail" ToRole="ToRole_FlightListFlightDetail" />

</EntityType>

- <Association Name="FlightListFlightDetail" sap:content-version="1">

<End Type="FLIGHTLISTDCR.FlightList" Multiplicity="1" Role="FromRole_FlightListFlightDetail" />

<End Type="FLIGHTLISTDCR.FlightDetail" Multiplicity="1" Role="ToRole_FlightListFlightDetail" />

- <ReferentialConstraint>

- <Principal Role="FromRole_FlightListFlightDetail">

<PropertyRef Name="Flightdate" />

<PropertyRef Name="Connectid" />

<PropertyRef Name="Airlineid" />

</Principal>

- <Dependent Role="ToRole_FlightListFlightDetail">

<PropertyRef Name="Flightdate" />

<PropertyRef Name="Connectid" />

<PropertyRef Name="Airline" />

</Dependent>

</ReferentialConstraint>

</Association>

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

<EntitySet Name="FlightDetails" EntityType="FLIGHTLISTDCR.FlightDetail" sap:pageable="false" sap:addressable="false"
sap:content-version="1" />

<EntitySet Name="FlightLists" EntityType="FLIGHTLISTDCR.FlightList" sap:requires-filter="true" sap:content-version="1" />

- <AssociationSet Name="AssocSet_FlightListFlightDetail" Association="FLIGHTLISTDCR.FlightListFlightDetail"
sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">

<End EntitySet="FlightLists" Role="FromRole_FlightListFlightDetail" />

<End EntitySet="FlightDetails" Role="ToRole_FlightListFlightDetail" />

</AssociationSet>

</EntityContainer>

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

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

</Schema>

</edmx:DataServices>

</edmx:Edmx>

The Error log message is vague and is as follows:

Internal error occurred, contact your system administrator.

Shall be grateful for any hints which could help me resolve this issue.

regards

Nitesh

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182048
Active Contributor
0 Kudos

Hi Nitesh

In the payload of a query do you get related links, if so how do they represent the predicate.

eg <link rel=

You may want to have a look in the log, check where it throws the exception and put a break point in and debug.

Cheers

John P

nitesh_jain3
Active Participant
0 Kudos

Hi John,

I had added the key predicates as per the related link in the payload of the query. The complete payload of the entry is:

<entry>

<id>http://<host>:8000/sap/opu/odata/SAP/FLIGHTLISTDCR/FlightLists(Flightdate=datetime'2013-09-04T00%3A00%3A00',Connectid='0017',Airlineid='AA')</id>

<title type="text">FlightLists(Flightdate=datetime'2013-09-04T00%3A00%3A00',Connectid='0017',Airlineid='AA')</title>

<updated>2013-02-07T05:07:14Z</updated>

<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"

term="FLIGHTLISTDCR.FlightList" />

<link href="FlightLists(Flightdate=datetime'2013-09-04T00%3A00%3A00',Connectid='0017',Airlineid='AA')" rel="edit" title="FlightList" />

<link href="FlightLists(Flightdate=datetime'2013-09-04T00%3A00%3A00',Connectid='0017',Airlineid='AA')/FlightDetail"

title="FlightDetail" type="application/atom+xml;type=entry" />

- <content type="application/xml">

- <m:properties>

   <d:Airportto>SFO</d:Airportto>

<d:Cityfrom>NEW YORK</d:Cityfrom>

<d:Airportfr>JFK</d:Airportfr>

<d:Flightdate>2013-09-04T00:00:00</d:Flightdate>

<d:Connectid>0017</d:Connectid>

<d:Airline>American Airlines</d:Airline>

<d:Airlineid>AA</d:Airlineid>

<d:Cityto>SAN FRANCISCO</d:Cityto>

<d:Deptime>PT11H00M00S</d:Deptime>

<d:Arrtime>PT14H01M00S</d:Arrtime>

<d:Arrdate>2013-09-04T00:00:00</d:Arrdate>

<d:Price>422.9400</d:Price>

<d:Curr>USD</d:Curr>

<d:CurrIso>USD</d:CurrIso>

</m:properties>

</content>

</entry>

I am trying to debug referring to the call stack of the error log but have not yet been able to find the real reason of this error.

regards

Nitesh

former_member182048
Active Contributor
0 Kudos

Nitesh

does this link work?

<link href="FlightLists(Flightdate=datetime'2013-09-04T00%3A00%3A00',Connectid='0017',Airlineid='AA')/FlightDetail

jp

nitesh_jain3
Active Participant
0 Kudos

Hi John,

I suffixed this link to the basic service URL (stated in my original message post) and it is not working.

Not sure if i have understood your question correctly.

regards

Nitesh

former_member182048
Active Contributor
0 Kudos

Hi Nitesh

Your URL and the one created by your Gateway system had a number of differences, just wanted to ensure it wasn't human error.

JSP

nitesh_jain3
Active Participant
0 Kudos

Hi,

Apologies for the confusion this difference has caused.

I have tested the exact URL generated by the Gateway system and am getting the same error.

regards

Nitesh

nitesh_jain3
Active Participant
0 Kudos

Hi All,

Debugging revealed that there is an issue in the service implementation using the 'Map to Data Source' option to a BAPI method.

In my case the ABAP code generated automatically in the Method <Entity type>_GET_ENTITY in my BASE class for mapping key fields had ONE key field missing. This bug is there in a specific scenario which is currently unknown to me.

I created a new project, maintained the respective objects as before and now the key predicates are working correctly.

Anyone using referential constraints in their project kindly check the code in the Base class in case you get errors!!!

I will post this bug in OSS and have SAP look at it.

regards

Nitesh