繁体   English   中英

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

[英]PUT method to oData model with Edm.Time type

我试图用时间元素(类型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不代表有效的日期/时间并在上面的时间戳中搜索条目以获取更多详细信息,请参阅SAP Note 1797736进行错误分析( https://service.sap.com/sap/support/notes/1797736 )有关使用$ batch的详细信息请参阅SAP Note 1869434( https: //service.sap.com/sap/support/notes/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--

看起来这是提供给模型调用的上下文的__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+"')", 
                                      context);

现在它像

              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,
                                      });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM