Skip to Content

How to submit Head/Item data to OData service

Jun 29, 2017 at 04:25 PM


avatar image
Former Member

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:


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';
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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Jun 29, 2017 at 08:43 PM

I use JQuery to get the values and it works.

$(".sapMInputBaseInner").each(function(index) {
	inputValues[index] = $(this).val();
10 |10000 characters needed characters left characters exceeded