cancel
Showing results for 
Search instead for 
Did you mean: 

entity read for SAP UI 5 mobile application

Former Member
0 Kudos

Hi ,

I am developing a sample mobile app.

In the left panel , i do item search .

If i choose an item from the result ,the description of the item should be displayed in the right panel .

Item search is working fine since it is entity set filtering.

But item desc display is not working .It is an entity read

/********* view.js *********/

var oitemDetailsPage = new sap.m.Page("itemDetails", {

    title : "Item Details",

    content : [ new sap.m.Label({

  text : "Item Details Page"

                }) ,

                new sap.m.Text("itemLongText",{text : ""}) ,

              

      ]

});

/********* view.js  ends*********/

/********* controller.js *********/

getItemDetails: function(itemId){

  var oModel = new sap.ui.model.odata.ODataModel(serviceUrl,true);

     var itemLongText = sap.ui.getCore().byId("itemLongText");

  

     itemLongText.setModel(oModel);

    itemLongText.bindText({path: "/ItemDetails(IpArticleNo='"+itemId+"',IpStoreNo='2000')", parameters:{select: "LongText"}});

    

}

/********* controller.js ends *********/

Am i binding the component in correct way ?

Can anyone please correct the syntax.

Or give a sample code on how to perform entity read and bind the output to sap.m component

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Madhumita,

                         You can use the oModel.read method in the oDataModel and get the description in json format and then set the Text.

ex :

fnSuccess = function(jsonstringresponse){

sap.ui.getCore().byId("itemLongText").setText(jsonstringresponse.LongText);

};

oModel.read("/ItemDetails(IpArticleNo='"+itemId+"',IpStoreNo='2000')",

  null, null, true,fnSuccess,fnError);

Regards,

             Pruthvi.

Former Member
0 Kudos

Thanks for your help

Answers (0)