使用Edm.Time类型的oData模型的PUT方法

时间:2015-09-22 08:03:15

标签: javascript time odata sapui5 put

我正在尝试使用time元素(类型为Edm.Time)实现可编辑的表元素。当更改表中的值并且应用程序发送PUT请求时出现问题。

时间对象的值例如是“PT11H00M00S”并且我已经通过元数据分配了类型“Edm.Time”以避免“Edm.string”比较问题。但现在oData服务是SAP显示如下。如何格式化值以避免此问题?提前谢谢

2015-09-22 09:52:09发生以下问题:HTTP请求失败400,错误请求,CX_SY_CONVERSION_NO_DATE_TIME/67AA6842BAA80B7DE10000000A15523C值PNaNDTNaNHNaNMNaN.NaNS不代表有效日期/时间56003C39FEB4710DE10000000A10010C20150922075209.8761770运行事务/ IWFND / ERROR_LOG开启SAP NW Gateway集线器系统并搜索具有上述时间戳的条目以获取更多详细信息请参阅SAP Note 1797736以进行错误分析(https://service.sap.com/sap/support/notes/1797736)有关使用$ batch(https://service.sap.com/sap/support/notes/1869434)的详细信息,请参阅SAP Note 1869434 -

在SAP方面,我发现以下请求已收到

--batch_6bba-3b1b-e53d
content-type: multipart/mixed; boundary=changeset_3e78-e6a1-305d

--changeset_3e78-e6a1-305d
content-type: application/http
content-transfer-encoding: binary

PUT modelData(pdsnr='000000000130') HTTP/1.1
Accept-Language: EN
Accept: application/atom+xml,application/atomsvc+xml,application/xml
MaxDataServiceVersion: 2.0
DataServiceVersion: 2.0
Content-Type: application/atom+xml
Content-Length: 716

<a:entry xmlns:a="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><a:author><a:name/></a:author><a:category term="ns.type" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><a:content type="application/xml"><m:properties><d:pdsnr m:type="Edm.String">000000000130</d:pdsnr><d:fullName m:type="Edm.String"/><d:alias m:type="Edm.String">ABCD</d:alias><d:pernr>95000104</d:pernr><d:direction m:type="Edm.String">P10</d:direction><d:date m:type="Edm.DateTime">2015-09-21T00:00:00</d:date><d:time m:type="Edm.Time">PNaNDTNaNHNaNMNaN.NaNS</d:time></m:properties></a:content></a:entry>
--changeset_3e78-e6a1-305d--

--batch_6bba-3b1b-e53d--

1 个答案:

答案 0 :(得分:0)

看起来像是提供给模型调用的上下文的__metadata属性中的问题。

              var obj = oSelectedItem.getBindingContext().getObject();
              var context = oEvent.getSource().getBindingContext().getObject();

              context.ldate    = obj.ldate;
              context.ltime    = obj.ltime;

              oController.onRowUpdate("/modelData(pdsnr='"+context.pdsnr+"')", 
                                      {ldate:    obj.ldate,
                                       ltime:    obj.ltime,
                                      });

现在它可以作为

SELECT *, SUM(DS.UnitPrice*Ord.Qty) as LineTotal ,SUM(LineTotal) as SubTotal,SUM(SubTotal*1.1) as TotalPrice
FROM (Orders Ord, Donuts DS, Customers Cust)
LEFT JOIN Customers ON (Cust.CustID = Ord.OrderID)
LEFT JOIN Donuts ON (DS.DonutID = Ord.DonutID)