Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9269

SAPUI5 help display data from 1..1 Navigational Properties in xml view

$
0
0

Hi UI5 Programming Guru’s
I am quite new to programming in UI5 – and i have a problem that I hope some of you folks can help me achieve

 

I have created an odata service that has two entities:

  Reminder and PersonalData
There is a navigation property from Reminders to PersonalData called Get_Personal_Data.
The association is 1  to 1.

Here is a snip of my metadata:


<EntityType Name="Reminder" sap:content-version="1"><Key><PropertyRef Name="Pernr"/><PropertyRef Name="Infty"/><PropertyRef Name="Subty"/></Key><Property Name="Pernr" Type="Edm.String" Nullable="false" MaxLength="8" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
....<NavigationProperty Name="Get_Personal_Data" Relationship="Z2BM_REMINDER_OF_DATES_SRV.ReminderPersonalDataAss" FromRole="FromRole_ReminderPersonalDataAss" ToRole="ToRole_ReminderPersonalDataAss"/></EntityType><EntityType Name="PersonalData" sap:content-version="1"><Key><PropertyRef Name="Perno"/></Key><Property Name="Perno" Type="Edm.String" Nullable="false" MaxLength="8" sap:label="Medarbejdernr." sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
......</EntityType><Association Name="ReminderPersonalDataAss" sap:content-version="1"><End Type="Z2BM_REMINDER_OF_DATES_SRV.Reminder" Multiplicity="1" Role="FromRole_ReminderPersonalDataAss"/><End Type="Z2BM_REMINDER_OF_DATES_SRV.PersonalData" Multiplicity="1" Role="ToRole_ReminderPersonalDataAss"/><ReferentialConstraint><Principal Role="FromRole_ReminderPersonalDataAss"><PropertyRef Name="Subty"/><PropertyRef Name="Infty"/><PropertyRef Name="Pernr"/></Principal><Dependent Role="ToRole_ReminderPersonalDataAss"><PropertyRef Name="Infotype"/><PropertyRef Name="Subtype"/><PropertyRef Name="Perno"/></Dependent></ReferentialConstraint></Association>


 

I have created a master detail view in the WebIDE – where I wanted to create the following scenario.

 

A master list with the Reminders Entityset.
And a detail set – with to icon tabbars.
Where I wanted to show some of the details regarding the event  - on one of the pages, and then some PersonalData on the other tab.

 

It looks like this:

 

screen1.PNG

 

The first part works fine – but i cant seem to find a solution on how to show the  something from the PersonalData entity set.

 

When I test the odata service it works just fine ie. I can call I like this:

/sap/opu/odata/SAP/Z2BM_REMINDER_OF_DATES_SRV/ReminderSet(Pernr='00000005',Infty='0019',Subty='05')/Get_Personal_Data

And then I get the  PersonalData entity set returned just fine.

 

But in  XML view – I tried the following:

 

<mvc:View                              xmlns:mvc="sap.ui.core.mvc"                              xmlns:sap.ui.core="sap.ui.core"                              xmlns:sap.ui.layout.form="sap.ui.layout.form"                              xmlns:semantic="sap.m.semantic"                              xmlns="sap.m"                              controllerName="local.controller.Detail">                             <semantic:DetailPage                                                           busy="{detailView&gt;/busy}"                                                           busyIndicatorDelay="{detailView&gt;/delay}"                                                           id="page"                                                           navButtonPress="onNavBack"                                                           showNavButton="{device&gt;/system/phone}"                                                           title="{i18n&gt;detailTitle}">                                                                                                                    <semantic:content>                                                                                       <ObjectHeader                                                                                                                     id="objectHeader"                                                                                                                     intro="Event details"                                                                                                                     title="{TmartText}"/>                                                                                       <IconTabBar class="sapUiResponsiveContentPadding" id="iconTabBar">                                                                                                                    <items>                                                                                                                                                 <IconTabFilter icon="sap-icon://hint" id="iconTabBarFilter1" text="Event details" tooltip="{i18n&gt;detailIconTabBarInfo}">                                                                                                                                                                              <content>                                                                                                                                                                                                           <sap.ui.layout.form:SimpleForm xmlns:sap.ui.layout.form="sap.ui.layout.form" editable="false" id="__form0" layout="ResponsiveGridLayout">                                                                                                                                                                                                                                        <sap.ui.layout.form:content>                                                                                                                                                                                                                                                                     <Label id="__label0" text=""/>                                                                                                                                                                                                                                                                     <Text id="__input0" text="{Text1}" width="100%"/>                                                                                                                                                                                                                                                                     <Label id="__labe20" text=""/>                                                                                                                                                                                                                                                                     <Text
 id="__input1" text="{Text2}" width="100%"/>                                                                                                                                                                                                                                                                     <Label id="__labe30" text=""/>                                                                                                                                                                                                                                                                     <Text id="__input2" text="{Get_Personal_Data/Firstname}" width="100%"/>                                                            //the above part does not work..                                                                                                                                                                                                                                         </sap.ui.layout.form:content>                                                                                                                                                                                                           </sap.ui.layout.form:SimpleForm></content>

In my controller of the detail view – I do the following:

 

 

_onObjectMatched: function(oEvent) {                                                                                       var sObjectId = oEvent.getParameter("arguments").objectId;                                                                                       var sInfty = oEvent.getParameter("arguments").infty;                                                                                       var sSubty = oEvent.getParameter("arguments").subty;                                                                                       this.getModel().metadataLoaded().then(function() {                                                                                                                    var sObjectPath = this.getModel().createKey("ReminderSet", {                                                                                                                                                 Pernr: sObjectId,                                                                                                                                                 Infty: sInfty,                                                                                                                                                 Subty: sSubty                                                                                                                    });                                                                                                                    this._bindView("/" + sObjectPath);                                                                                       }.bind(this));                                                          },

I haven’t implemented the expand function – because as far as I am concerned it should be possible to access the data through the navigational properties.

Can someone please advice me on how to make this work?

 

 

 

Br Ronni


Viewing all articles
Browse latest Browse all 9269

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>