Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

oModel.read(keys) errors: Expexted type is Edm.Decimal or Malformed URI

Hello friends,

I have a really annoying problem. On Gateway server there is one service with many keys and some of them are of type Decimal and Date. Service return just one entity (GetEntity - read). Services with just strings as keys make no problems but this one with decimal values does. I have a simple form with a number of fields that user fill with decimal values like 20.50 or 6000 and i try:

    jQuery.sap.require("sap.ui.core.format.NumberFormat");
   var oNumberFormat = sap.ui.core.format.NumberFormat.getFloatInstance({
      maxFractionDigits: 3,
      groupingEnabled: false,
      decimalSeparator: "."
   }); //Returns a NumberFormat instance for float
   
    var amount = oNumberFormat.parse(oView.byId("idCustomOfferAmount").valueOf().getValue());

or with simple type:

    var oType = new sap.ui.model.type.Float();
   oType = new sap.ui.model.type.Float({
      minIntegerDigits: 1, // minimal number of non-fraction digits
      maxIntegerDigits: 99, // maximal number of non-fraction digits
      minFractionDigits: 0, // minimal number of fraction digits
      maxFractionDigits: 2, // maximal number of fraction digits
      groupingEnabled: true, // enable grouping (show the grouping separators)
      groupingSeparator: ",", // the used grouping separator
      decimalSeparator: "." // the used decimal separator
   });

but whatever I do it always error 400 bad request "Invalid key predicate type for 'IMenge'. Expected type is Edm.Decimal"

Can anyone have an idea what is wrong or how I should do it.

Tags:
replied

Thank you all for help,

I find on Gateway server how respond look like when sent from Android application and funny thing is that decimal parameters have "d" letter on the end of the number an no apostrophes ' ' so I just read value from Input fields that are type sap.ui.model.type.Float or sap.ui.model.type.Currency and just add "d" on the end and remove apostophes ' ' from the call string (like: ",IMenge=" + amount + ") and then it all works..

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question