Skip to Content
1
Former Member
Dec 16, 2014 at 04:05 PM

How to add record in a table which is previously binded with a Service

121 Views

Hi All,

I am trying to add a single record in a table which is already binded

my scenerio is once i enter in a text field my order number i have to load its details in a table (sap.ui.table.table) control there is also a form above the table in my view in which user can enter values and add into the same table for any new item i have loaded my data after reteriving information from my data tables into my form fields and in the details table control but when i want to add any new detail in that table its not being adding. I am stuck and i dont not what to do or what i am doing wrong.

My code is like this

press: function()

{

var oSOS_Method = "/E_VBAKSet('"+oTF_OrderNo.getValue()+"')";

oTF_PoNumber.bindElement(oSOS_Method);

oCB_OrderType.bindElement(oSOS_Method);

oCB_Customer.bindElement(oSOS_Method);

var oTable = sap.ui.getCore().byId("orderDetails");

oTable.invalidate();

oTable.bindRows(oSOS_Method + "/SoToItem");

}

oTF_OrderNo is my text field and its value is being passed to my web service which is in return sending me order details

press: function(e)

{

//To retrieve Existing Data

var modelData = this.getModel().getData();

//alert(modelData); //Here model model data is being retrieving its showing null in alert

var aData = [];

//To Add Data In Existing table

aData.push(

{

MATNR : "000000000000016005",

ARKTX : oCB_SO_Field01.getLiveValue(),

ZSIDE : oCB_SO_Field02.getLiveValue(),

DIA : oCB_SO_Field03.getLiveValue(),

SPH : oCB_SO_Field04.getLiveValue(),

CYL : oCB_SO_Field05.getLiveValue(),

AXIS : oTF_SO_Field06.getValue(),

ZADD : oCB_SO_Field07.getLiveValue(),

KWMENG : oTF_SO_Field08.getValue(),

NETPR : oTF_SO_Field09.getValue(),

ZEXCH : oTF_SO_Field10.getValue(),

ZREASON : oTF_SO_Field11.getValue(),

NETWR : oNumberFormat.parse(oTF_SO_Field08.getValue())

* oNumberFormat.parse(oTF_SO_Field09.getValue())

+ oNumberFormat.parse(oTF_SO_Field10.getValue()),

VRKME : oCB_SO_LensUnit12.getLiveValue()

}

);

oModel.setData({modelData: aData});

oTable2.bindRows("/modelData");

}});

Please guide what i am doing wrong here