on ‎2019 Mar 09 7:42 PM
Dear Experts,
In order to learn $batch for ODATA, I have created a simple database table named ZODATABAT_PEOPLE which only contain the following fields as showing in the below screenshot:

I have also created the ODATA service and have generated and registered the service. Then I have extended the relevant methods for CREATE, GET_ENTITY and GET_ENTITYSET methods of the DPC_EXT class. From GW client, the service is working perfectly for both GET and POST methods. For POST, it is working for individual data insertion.
However, while I am trying to use POST method and using $batch to view the data, I am getting the error "In the context of Data Services an unknown internal server error occurred".
Here is what I am doing:

And I am getting the 500 Internal Server Error. Error log is showing Exception of type CX_SY_REF_IS_INITIAL has occurred.

My call stack as viewed from the error log is as follows:

While following the Call Stack from Error Log and debugging, I have come across the method /IWCOR/IF_REST_MP_ENTITY~GET_ENTITIES of class /IWCOR/CL_REST_BASE_ENTITY where the execution is going to line no. 12 where LO_ENTITY is initial. Referring to the comments that the multipart is not a valid document, I am not sure where I am going wrong.

And that is why null pointer exception is getting raised at line no. 33 as LO_ENTITY is getting returned as NULL from the method IO_REQUEST_ENTITY->GET_ENTITIES( ) at line no. 29.

I request your valuable inputs to guide me in this regard as to why the multipart document is not a valid document as per the comments in the GET_ENTITIES method in the previous screenshot.
Thanks and regards,
Anirban Sengupta
Request clarification before answering.
Hi,
I have resolved this myself with the inputs from Andre above. Would like to share the same.
There would have been one extra line feed between Content-Transfer-Encoding and the GET method.
Instead of writing as
Content-Transfer-Encoding: binary
GET PeopleSet(Id=1) HTTP/1.1
we should write as
Content-Transfer-Encoding: binary
<at least one "carriage return line feed">
GET PeopleSet(Id=1) HTTP/1.1
Below is the screenshot of the gateway client which is returning successful result (status code is 202)1.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andre,
First of all, thank you very much for your prompt and useful response.
I tried the solution you provided but I am still getting the same error as before and the execution is going through the same set of lines as before. Here is the screenshot of my current input and output in the GW_CLIENT.

I gave two line feeds before giving --batch_001--. But it is still going to the code as given in the screenshot below:

My ODATA service is as as shown in the screenshot below:

I am not sure where exactly I am missing it. Could you please guide me through? Just for your easier reference, I am again pasting the screenshot of my table entries as given below:

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your request does not have the correct Format.
Please have a look at the CORE_SAMPLES that can be generated within the SAP Gateway Client as described here:
https://blogs.sap.com/2013/06/21/demo-test-cases/
The payload of a valid GET request looks like shown below.
So your request is missing the last line
--batch_001--Here is a sample request from the CORE_SAMPLES
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Conversions(Id='0002') HTTP/1.1
--batch--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.