简体   繁体   中英

PUT method to oData model with Edm.Time type

i'm trying to implement editable table element with time element (type Edm.Time). the problem comes when changing value in table and application sends PUT request.

the value of time object is for example "PT11H00M00S" and i've assigned type "Edm.Time" via metadata to avoid "Edm.string" comparision problem. but now oData service is SAP shows as per below. how the value should be formatted to avoid this problem? thanks in advance

2015-09-22 09:52:09 The following problem occurred: HTTP request failed400,Bad Request, CX_SY_CONVERSION_NO_DATE_TIME/67AA6842BAA80B7DE10000000A15523C Value PNaNDTNaNHNaNMNaN.NaNS does not represent a valid date/time56003C39FEB4710DE10000000A10010C20150922075209.8761770Run transaction /IWFND/ERROR_LOG on SAP NW Gateway hub system and search for entries with the timestamp above for more detailsSee SAP Note 1797736 for error analysis ( https://service.sap.com/sap/support/notes/1797736 )See SAP Note 1869434 for details about working with $batch ( https://service.sap.com/sap/support/notes/1869434 ) -

on SAP side i found following request had received

--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--

look like it was problem in __metadata property of context providing to model calls.

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

now it works as

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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