SAPUI5 - How to bind fields of child entity in same panel as fields of parent entity in SAP Friori Sample "Approve PO" app? -


in sap sample "approve purchase order" application, comes sap web ide, how bind fields of "supplier" entity (child) in same "simple form" ui container control fields of "purchaseorder" (parent) entity. in sample, there 3 separate mock data files, 1 each "purchase order", "purchase order items" , "supplier". relationship between purchase order , supplier 1:1 defined in metadata.xml using association.

a) purchaseorder (relevant portion only)

<entitytype name="purchaseorder" sap:content-version="1" sap:is-thing-type="true">     <key>         <propertyref name="poid"/>     </key>     <property maxlength="10" name="poid" nullable="false" type="edm.string" sap:creatable="false" sap:filterable="false"         sap:label="purchase order id" sap:updatable="false"/>     <property maxlength="10" name="orderedbyid" nullable="false" type="edm.string" sap:creatable="false" sap:filterable="false"     <property maxlength="10" name="supplierid" nullable="false" type="edm.string" sap:creatable="false" sap:filterable="false" sap:label="id"         sap:sortable="false" sap:updatable="false"/> 

b) supplier (relevant portion only)

<entitytype name="supplier" sap:content-version="1" sap:is-thing-type="true">     <key>         <propertyref name="id"/>     </key>     <property maxlength="10" name="id" nullable="false" type="edm.string" sap:creatable="false" sap:filterable="false" sap:label="id"         sap:sortable="false" sap:updatable="false"/>     <property maxlength="255" name="email" nullable="false" type="edm.string" sap:creatable="false" sap:filterable="false" sap:label="e-mail"         sap:semantics="email" sap:sortable="false" sap:updatable="false"/> 

c) association

<association name="purchaseordersupplier" sap:content-version="1" sap:label="association: supplier --&gt; purchase order">     <end multiplicity="1" role="fromrole_purchaseordersupplier" type="epm_ref_apps_po_apv_srv.supplier"/>     <end multiplicity="*" role="torole_purchaseordersupplier" type="epm_ref_apps_po_apv_srv.purchaseorder"/>     <referentialconstraint>         <principal role="fromrole_purchaseordersupplier">             <propertyref name="id"/>         </principal>         <dependent role="torole_purchaseordersupplier">             <propertyref name="supplierid"/>         </dependent>     </referentialconstraint> </association> 

the portion of view (purchaseorderdetails.view.xml) shown below. fields, except email parent, purchaseorder entity.

<form:simpleform class="sapuiforcewidthauto sapuiresponsivemargin" columnsl="1" columnsm="1" emptyspanl="5" emptyspanm="5" id="poheaderform"     labelspanl="3" labelspanm="3" layout="responsivegridlayout" maxcontainercols="2" minwidth="1024" title="{i18n>xtit.formtitle}">     <label id="poidformlabel" text="{/#purchaseorder/poid/@sap:label}"/>     <text id="poidform" text="{poid}"/>     <label id="addressformlabel" text="{/#purchaseorder/deliveryaddress/@sap:label}"/>     <text id="addressform" text="{deliveryaddress}"/>     <label id="supplieremaillabel" text="{/#supplier/email/@sap:label}"/>     <text id="supplieremail" text="{/purchaseorder/id/email}"/> </form:simpleform> 

i have tried many permutations bind field, email, supplier entity viz: a) {/id/email}, b) {path: 'supplier' , parameters: {select 'email'}} result has been blank space.

please show correct binding syntax "email".

your metadata.xml snippet not contain navigationproperty supplier. therefore, association not recognized... have fix metadata.xml first. after can following:

<text id="supplieremail" binding="{supplier}" text="{email}"/> 

this assumes navigation property of have named navigationproperty "supplier" inside purchaseorder entity. in case suggest use $expand=supplier in binding in order supplier data in same request (the 1 purchaseorder), i.e. this:

items="{     path: '/purchaseorderitems',     parameters: {         'expand': 'supplier'     } }" 

after use without binding attribute because have 'expanded':

<text id="supplieremail" text="{supplier/email}"/> 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -