2022 Feb 04 7:00 AM
This is my $batch GET operation with parameters. As you can see the date parameter "PostDate" is filled with datetime value as datetime'2022-01-31T12:12:55'.
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET PostHeadSet(PostDate=datetime'2022-01-31T12:12:55' ,ContractID='TFS_I19_1234561' ,ContractCat='1' ,LegalEntity='TFS_I19' ,AccSystem='S_IFRS9' )?$expand=ItemsNav HTTP/1.1
--batch
--batch--
The response shows error "Invalid URI Segment"
In debugging, at the following method /IWCOR/CL_DS_PROC_DISPATCHER->PARSE_BATCH_REQUEST, line 143, the value for URI gets truncated for the datetime value, which is causing this issue. Any idea how to pass this datetime value so that this URI accepts the value in proper format?
Thanks, Shyam
2023 Feb 01 11:33 AM
For anyone currently having this issue, I was able to solve it with the use of encodeURIComponent. Check the example below:
var sPath = "/TestDateSet(Test='" + sTest + "',Testdat=datetime'" + encodeURIComponent((sDate + "T00:00:00")) + "'";
_oODataModel.read(sPath, { success: fSuccess, error: fError });
Make sure that sDate has the format yyyy-MM-dd in this case I'm not using an actually DateTime value that's why I'm passing "T00:00:00" in front of sDate, just make sure your DateTime value follows this format yyyy-MM-ddTHH:mm:ss and it should work.
2023 Mar 13 3:06 PM
I faced the exact same issue with datetime in batch. Thank you for your post