cancel
Showing results for 
Search instead for 
Did you mean: 

Association Set Binding in Detail or Object view

Former Member
0 Kudos
1,308

Hey guys,

i am stuck with a problem concerning association navigation in SAP UI 5 Apps.

Basic idea is a Room Management Tools which lists assigned events to a room.

My OData Service looks like this:


<?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="ZY_SS16_09_ROOMMANAGEMENT_SRV" xml:lang="de" sap:schema-version="1"

            xmlns="http://schemas.microsoft.com/ado/2008/09/edm">

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

                <Key>

                    <PropertyRef Name="ROOMID"/>

                </Key>

                <Property Name="ROOMID" Type="Edm.String" Nullable="false" MaxLength="9" sap:updatable="false" sap:sortable="false"/>

                <Property Name="MODULEID" Type="Edm.String" Nullable="false" MaxLength="8"/>

                <Property Name="NAME" Type="Edm.String" Nullable="false" MaxLength="256"/>

                <Property Name="PARTICIPANTS" Type="Edm.Int16" Nullable="false" sap:label="Untzeich.INT2/int16"/>

                <Property Name="DEPARTMENT" Type="Edm.String" Nullable="false" MaxLength="50"/>

                <Property Name="LECTURER" Type="Edm.String" Nullable="false" MaxLength="50"/>

                <Property Name="ASSIGNEDDATE" Type="Edm.DateTime" Precision="0" sap:label="Datum"/>

                <Property Name="STARTTIME" Type="Edm.Time" Precision="0"/>

                <Property Name="ENDTIME" Type="Edm.Time" Precision="0"/>

            </EntityType>

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

                <Key>

                    <PropertyRef Name="ROOMID"/>

                </Key>

                <Property Name="ROOMID" Type="Edm.String" Nullable="false" MaxLength="9"/>

                <Property Name="NAME" Type="Edm.String" Nullable="false" MaxLength="50"/>

                <Property Name="CAPACITY" Type="Edm.Int16" sap:label="Untzeich.INT2/int16"/>

                <Property Name="FACULTY" Type="Edm.String" MaxLength="50"/>

                <Property Name="DEPARTMENT" Type="Edm.String" MaxLength="50"/>

                <Property Name="ROOMTYPE" Type="Edm.String" Nullable="false" MaxLength="3"/>

                <Property Name="PROJECTOR" Type="Edm.Boolean" Nullable="false" sap:label="Flag"/>

                <NavigationProperty Name="EventSet" Relationship="ZY_SS16_09_ROOMMANAGEMENT_SRV.RoomToEvents" FromRole="FromRole_RoomToEvents" ToRole="ToRole_RoomToEvents"/>

            </EntityType>

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

                <End Type="ZY_SS16_09_ROOMMANAGEMENT_SRV.Room" Multiplicity="1" Role="FromRole_RoomToEvents"/>

                <End Type="ZY_SS16_09_ROOMMANAGEMENT_SRV.Event" Multiplicity="*" Role="ToRole_RoomToEvents"/>

                <ReferentialConstraint>

                    <Principal Role="FromRole_RoomToEvents">

                        <PropertyRef Name="ROOMID"/>

                    </Principal>

                    <Dependent Role="ToRole_RoomToEvents">

                        <PropertyRef Name="ROOMID"/>

                    </Dependent>

                </ReferentialConstraint>

            </Association>

            <EntityContainer Name="ZY_SS16_09_ROOMMANAGEMENT_SRV_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">

                <EntitySet Name="RoomSet" EntityType="ZY_SS16_09_ROOMMANAGEMENT_SRV.Room" sap:searchable="true" sap:requires-filter="true" sap:content-version="1"/>

                <EntitySet Name="EventSet" EntityType="ZY_SS16_09_ROOMMANAGEMENT_SRV.Event" sap:searchable="true" sap:requires-filter="true" sap:content-version="1"/>

                <AssociationSet Name="RoomToEventsSet" Association="ZY_SS16_09_ROOMMANAGEMENT_SRV.RoomToEvents" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">

                    <End EntitySet="RoomSet" Role="FromRole_RoomToEvents"/>

                    <End EntitySet="EventSet" Role="ToRole_RoomToEvents"/>

                </AssociationSet>

            </EntityContainer>

            <atom:link rel="self" href="./sap/ZY_SS16_09_ROOMMANAGEMENT_SRV/$metadata"

                xmlns:atom="http://www.w3.org/2005/Atom"/>

                <atom:link rel="latest-version" href="./sap/ZY_SS16_09_ROOMMANAGEMENT_SRV/$metadata"

                    xmlns:atom="http://www.w3.org/2005/Atom"/>

                </Schema>

            </edmx:DataServices>

        </edmx:Edmx>

So my Navigation Path i handle in the EVENTSET_GET_ENTITY_SET Method looks like this:  /RoomSet('RoomID')/EventSet

If i test it with an explicit RoomID it returns a Set of Events.

In the XML ObjectView where i navigated using /RoomSet(RoomID), i have a table which is binded like this:


<Table id="eventTable" mode="SingleSelectLeft"  inset="false" items="{path: 'EventSet'}">

Now instead of the expected Set with different Items, it shows the right amount of items but the always the same item.

I tried do debug the service call but the backend always provides the correct data. But the Method for getting the Set is called "Item times".

Has anyone experienced this problem? Whats my mistake with the binding ?

Best Regards,

Lukas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I resolved the problem by defining a second key attribute in the gateway service and by implementing the GET_ENTITY Method.

I think that the missing second key caused the application to use a One-One Relation, which was not intended by me.

Answers (0)