cancel
Showing results for 
Search instead for 
Did you mean: 

How to submit Head/Item data to OData service

0 Kudos

Hi Gurus

My UI5 app needs to update Head/Item kind of data via OData service. I have defined Head, HeadSet, Item and ItemSet in SEGW.

Everything looks well, it can be tested via /sap/opu/odata/sap/Z_XXXX_SRV/HeadSet('ID')?$expand=<NavProp>.

Now on the page I have a table for the Items, one of the columns (e.g., RealQty) is editable. User enter numbers here and that numbers should be submitted to backend for updating.

The problem is, I can not get the numbers user entered. I tried to use below code:

this.getView().byId('itemTable').getBinding('items').getContexts()[0].getProperty('RealQty')

But it always returns 0, which is the initial value. All other fields can be get by this way (of course those are also initial values). What's the problem here? Why the values entered by user are not updated into the model?

Over all I am trying to use below code for DEEP updating:

var oHead = {};
var oItem = {};
var items = [];
			
oHead.field1 = 'XXXX';
oHead.field2 = 'XXXX';
			
oItem.field1 = 'xxxx';
oItem.field2 = 'xxxx';
			
items.push(oItem);
		
oHead.NavProp = items;
			
var oModel = this.getView().getModel();
oModel.create('/HeadSet', oHead, null, 
			function() {alert('Successed')}, 
			function() {alert('Failed')});

Of course in Create method, I will do Updating actually.

Any idea? Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I use JQuery to get the values and it works.

$(".sapMInputBaseInner").each(function(index) {
	inputValues[index] = $(this).val();
});

Answers (0)