Skip to Content

Databinding on formfield with path not working

Hey there,

I have a XML-form with odata-binding. Normal binding to fields is working.

But the binding with value="{ path: ...}" is not working.

I have some dates to show, and all I get from SAP is /Date(1512086400000)/. I want to format this as shown on Text-tag.


			id="bestForm" >
			<Label displayOnly="true" wrapping="true" text="Bestellung" for="edtEBELN" required="true"/>
			<Input id="edtEBELN" change="onEbelnChange" valueLiveUpdate="true"></Input>
			<Label displayOnly="true" wrapping="true" text="Lieferschein" for="edtLIEFS" required="true"/>
			<Input id="edtLIEFS" change="onLiefsChange" value="{bestellung>Bktxt}" valueLiveUpdate="true"></Input>
			<Label displayOnly="true" wrapping="true" text="Belegdatum" for="edtBELDAT" required="true"/>
			<Input id="edtBELDAT" change="onBeldatChange" value="{/d/Lfdat}" valueLiveUpdate="true"></Input>
			<Label displayOnly="true" wrapping="true" text="Lagerort" for="edtLGORT"/>
				valueLiveUpdate="true" />
			<Label displayOnly="true" wrapping="true" text="Bestelldatum" for="edtBESTDAT"/>
			<Input id="edtBESTDAT" 
				<Label displayOnly="true" wrapping="true" text="Text" for="txt"/>
				<Text id="txt" text="{
  path: '/d/Bestdat',
  type: 'sap.ui.model.type.Date',
  formatOptions: {
  style: 'long',
  source: {
  pattern: 'yyyy/MM/dd'
  }" valueLiveUpdate="true"/>
			<Label displayOnly="true" wrapping="true" text="Anforderer" for="edtANFORD"/>
			<Input id="edtANFORD" editable="false" value="{/d/Lgnum}" valueLiveUpdate="true"></Input>

JS with Binding:

var url = "http://----:---/sap/opu/odata/sap/ZWM_MDE_SRV_03/BESTSet(Ebeln='"+ebeln+"',Lgnum='110')";
		var oModel = new sap.ui.model.json.JSONModel(url, true);
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 18, 2017 at 03:16 PM

    this line has to be in header script...

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 02, 2017 at 04:16 AM

    Hi Sven Schuberth,

    You can format date in your XML view like the foll.

    <Text text="{
             path: 'Name-Of-Your-Date-Field',
             type: 'sap.ui.model.type.Date',
             formatOptions: {
               pattern: 'yyyy/MM/dd'                    //Here you can pass any pattern as per your requirement

    Apart from this, you can define an formatter function and modify your date format there.

    Hope this helps,


    Add comment
    10|10000 characters needed characters exceeded

  • Dec 04, 2017 at 07:38 AM

    Hi Arjun Biswas,

    unfortunately it doesn't work. I think it's not a problem with the pattern. Instead the binding isn't working properly.

    This is my datasource json-model:


    If I bind directly, it works:

    <Text text="{/d/Bestdat}" />

    But if I bind via the following code it doesn't show anything:

    <Text text="{ path: '/d/Bestdat' }" />

    Any suggestions?

    Kind regards - Sven

    Add comment
    10|10000 characters needed characters exceeded