Skip to Content
avatar image
Former Member

Update OData failed SAPUI5


I have some problems with update function. In OData Service it is everything working, there are no problems. I have tested. So, the problem is in Frontend in Form.

I can make update first time, but at the second time the program says about this problem.

If I update my page I can update my OData again but only one time.

I don't understand why my program says about duplicate id of input field...

There are my code of update function

	onUpdate: function() {
		var inputFragment = sap.ui.xmlfragment(


		var Zeile1 = this.byId("Row1").getValue();
		var ID1 = this.byId("ID").getValue();
		var Activity = this.byId("Activity").getValue();
		var Level = this.byId("Level").getValue();
		var Plot = this.byId("Plot").getValue();
		var Area = this.byId("Area").getValue();
		var Description = this.byId("Description").getValue();
		var ZzStartmonth = this.byId("ZzStartmonth").getValue();
		var ZzActivitymonth = this.byId("ZzActivitymonth").getValue();
		var ZzMinutetotal = this.byId("ZzMinutetotal").getValue();
		var ZzMinutebase = this.byId("ZzMinutebase").getValue();
		var Itground = this.byId("Itground").getValue();
		var iteration = this.byId("Iteration").getValue();
		var oModel = this.getView().getModel();

		var data = {
			ZzID: ID1,
			ZzActivity: Activity,
			ZzLevel: Level,
			ZzPlot: Plot,
			ZzArea: Area,
			ZzDescription: Description,
			ZzStartmonth: ZzStartmonth,
			ZzActivitymonth: ZzActivitymonth,
			ZzMinutetotal: ZzMinutetotal,
			ZzMinutebase: ZzMinutebase,
			ZzIteration: iteration,
			ZzGroundarea: Itground


		var dialog = new sap.m.Dialog({
			title: 'Confirm',
			type: 'Message',
			content: new sap.m.Text({
				text: 'Wollen Sie die Daten ändern?'

			beginButton: new sap.m.Button({
				text: 'Submit',
				press: function() {

						"/AllevoSat88Set(Zeile=" + "'" + Zeile1 + "'" +
						",Version='0',Pjahr='2013',Coobject='0000009999',Setclass='0101',Kokrs='1000',Mandt='800')", data, {
							merge: true

					);'Submit pressed!');

			endButton: new sap.m.Button({
				text: 'Cancel',
				press: function() {
			afterClose: function() {

p1.png (122.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 20, 2017 at 04:21 PM

    Whenever an Update is triggered, you are instantiating the fragment. So when you hit 'Update' second time, the earlier instance (upon first update) still exists, so no new instantiation fails due to duplicate id.

    Why are you instantiating a fragment upon 'Update'?

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 20, 2017 at 06:49 PM

    issue with fragment initialisation, remove it if not needed OR

    declare var as global and assign fragment to it when its initial, as below:

    this.inputFragment= ""; //global, may be in onInit function
    if(this.inputFragment == ""){
      this. inputFragment = sap.ui.xmlfragment(



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 23, 2017 at 08:00 AM

    Thank you for your help! Now it works!

    Add comment
    10|10000 characters needed characters exceeded