Skip to Content
avatar image
Former Member

oModel.update is not working . PUT method showing Error 400 -BAD REQUEST


I am working on XSODATA and trying to update a table with UI5 screen. I am updating a table using oModel.Update method but getting error as 400 Bad Request(Request contains properties that do not exist in entity 'measuredef_serviceType)

Also my Request Payload is showing the correct data which I'm trying to post. I'll post the screenshots also.

Update coding :

		 oContext = oTable.getContextByIndex(iSelectedIndex);
		var oModel = oTable.getModel();
//			//var sPath = oEvent.getParameter("oContext").getPath();

			var data  = oModel.getProperty(oContext.sPath);
			var low = data.Low;
			var high = data.High;
			var option = data.Option;
			var hier = data.Hier_Level;
	save : function(){
		var mNewEntry = {};
		mNewEntry.Option = sap.ui.getCore().byId("option").getValue()
		mNewEntry.Low = sap.ui.getCore().byId("low").getValue();
		mNewEntry.High = sap.ui.getCore().byId("high").getValue();
		mNewEntry.Hier_level = sap.ui.getCore().byId("hier").getValue();

//					"Records updated Successfully.",{
//						icon : sap.m.MessageBox.Icon.SUCCESS,
//						title : "Dear User",
//						styleClass : "sapUiSizeCompact"
//					});
		}, function(err){

My Entity :

<EntityType Name="measuredef_serviceType">
<PropertyRef Name="ID"/>
<PropertyRef Name="Measure"/>
<PropertyRef Name="Source"/>
<PropertyRef Name="Dimension"/>
<PropertyRef Name="Seq_no"/>
<Property Name="ID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Measure" Type="Edm.String" Nullable="false" MaxLength="50"/>
<Property Name="Source" Type="Edm.String" Nullable="false" MaxLength="3"/>
<Property Name="Dimension" Type="Edm.String" Nullable="false" MaxLength="20"/>
<Property Name="Seq_no" Type="Edm.String" Nullable="false" MaxLength="10"/>
<Property Name="Sign" Type="Edm.String" MaxLength="2"/>
<Property Name="Option" Type="Edm.String" MaxLength="2"/>
<Property Name="Low" Type="Edm.String" MaxLength="10"/>
<Property Name="High" Type="Edm.String" MaxLength="10"/>
<Property Name="Hier_Level" Type="Edm.Int32"/>

Request Payload :

<a:entry xmlns:a="" xmlns:m="" xmlns:d=""><a:author><a:name/></a:author><a:content type="application/xml"><m:properties><d:Option>BT</d:Option><d:Low>680499</d:Low><d:High>680500</d:High><d:Hier_level>1</d:Hier_level></m:properties></a:content></a:entry>
error.png (14.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 16, 2017 at 04:27 PM
    L in uppercase
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks a lot Jun Wu for the answer.

      Was really struggling with this error but couldn't figure out this small mistake.