Skip to Content
0
Jun 16, 2016 at 09:27 AM

odata bind with sap.m.table

79 Views

Hi,

IN SAPUI5 My Odata service name is

http://XXX/sap/opu/odata/sap/ZPS_SOHDRITM_SRV

service details

<app:service xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xml:lang="en" xml:base="http://XXX/sap/opu/odata/sap/ZPS_SOHDRITM_SRV/">

<app:workspace>

<atom:title type="text">Data</atom:title>

<app:collection xmlns:sap="http://www.sap.com/Protocols/SAPData" sap:content-version="1" href="soitem">

<atom:title type="text">soitem</atom:title>

<sap:member-title>soitem</sap:member-title>

</app:collection>

<app:collection xmlns:sap="http://www.sap.com/Protocols/SAPData" sap:content-version="1" href="soheader">

<atom:title type="text">soheader</atom:title>

<sap:member-title>soheader</sap:member-title>

</app:collection>

</app:workspace>

<atom:link rel="self" href="http://XXX/sap/opu/odata/sap/ZPS_SOHDRITM_SRV/"/>

<atom:link rel="latest-version" href="http://XXX/sap/opu/odata/sap/ZPS_SOHDRITM_SRV/"/>

</app:service>

in my detail page there is a sap.m.table

Header 1

<Table

id="tblItems"

headerText="{i18n>LineItemTableHeader}"

>

<columns>

<Column>

<header><Label text="Product" /></header>

</Column>

<Column

minScreenWidth="Tablet"

demandPopin="true"

hAlign="Center" >

<header><Label text="Delivery Date" /></header>

</Column>

<Column

minScreenWidth="Tablet"

demandPopin="true"

hAlign="Center" >

<header><Label text="Quantity" /></header>

</Column>

<Column

hAlign="Right" >

<header><Label text="Price" /></header>

</Column>

</columns>

<ColumnListItem

type="Navigation"

press="handleLineItemPress" >

<cells>

<Text

text="{Posnr}" />

<Text

text="{

path:'Ntgew'

}"/>

<Text

text="{

path:'Kwmeng'

}"/>

<ObjectNumber

number="{Netpr}"

numberUnit="{Waerk}" />

</cells>

</ColumnListItem>

</Table>

I am not able to bind the sap.m.table with

this.byId("tblItems").bindItems("/soheader('0000004970')/hdrtoitems", ColumnListItem);

can you please help me how to bind table directly with odata using expand url ?

Odata url for header item is

Header:

http://XXX/sap/opu/odata/sap/ZPS_SOHDRITM_SRV/soheader


Item:

http://XXX/sap/opu/odata/sap/ZPS_SOHDRITM_SRV/soheader('0000004970')/hdrtoitems


Note: I'm able to bind the sap.m.table using odata read functionality but I want to bind data directly with ODATA in SAPUI5


Thanks in advance.

Regards,

Mriganka