cancel
Showing results for 
Search instead for 
Did you mean: 

$batch not working for Function Import in OData

raina_goyal
Participant
0 Kudos

Hi Experts,

We are using function import in our OData (SEGW - POST) which is working fine but now our requirement is to use the function import in Batch. I tried below in gateway:

Below URL in Gateway Client - and used the POST method with the content type:

multipart/mixed; boundary=batch

/sap/opu/odata/sap/Z_****_SRV/$batch

--batch
 Content-Type:
application/http
 Content-Transfer-Encoding:
binary
GET start?XYZ='90/100/2019/03'&ABC='****'&User='****'HTTP/1.1
--batch
 Content-Type:
application/http
 Content-Transfer-Encoding:
binary
GET start?XYZ='90/100/2019/09'&ABC='****'&User='*****'HTTP/1.1
--batch 

I above start is function Import name and XYZ,ABC and User are the import parameters for the function import.

But we are getting 500 error which says "DeReferencing the NULL Reference"

Please help as we are stuck and not able to find anything regarding this.

Thanks,

Best Regrads,

Raina

Accepted Solutions (1)

Accepted Solutions (1)

HemendraS
Participant
0 Kudos

Hi Raina,

Please do below correction, I also made mistake

Spacing in rows 0-1-1-2-1-2 and followed by

--changeset--

--batch--


I hope it will work.

Thanks,

Hemendra

Answers (1)

Answers (1)

HemendraS
Participant
0 Kudos

Hi Raina,

As today is Lord Krishna's B'Day...so Hare-Krishna.

I hope you implemented below methods in your DPC_EXT:

Redefined below for Function Import logic, as per your requirements

1. /IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION

Redefined below for $batch (Which is nothing but commented code inside below method)- as shown below:

2. /IWBEP/IF_MGW_APPL_SRV_RUNTIME~ CHANGESET_BEGIN

3. /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGE SET_END

4. Also may be check - Filter

You would have already tested successfully your single Function Import without batch first.

So probably in your gateway client please test like below:

URL: with POST

/sap/opu/odata/sap/Z_****_SRV/$batch

HEADER: Please also add x-csrf-token along with Content-Type

Content-Type: multipart/mixed; boundary=batch

Request Body: Request Body is little tricky part, need extra care for successful testing

--batch 
Content-Type: multipart/mixed; boundary=changeset


--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
Accept: application/xml
 
POST start?XYZ='90/100/2019/03'&ABC='****'&User='**** 'HTTP/1.1


--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
Accept: application/xml

POST start?XYZ='90/100/2019/09'&ABC='****'&User='*****' HTTP/1.1


--changeset
--batch

Please be careful with line space in Request Body, this should be:

From Top --batch to --changeset 0-2-1-2-1-2

I hope if above is taken care, this should work.

raina_goyal
Participant
0 Kudos

Dear Hemendra,

Thanks for the response but all the points shared by you has already been taken care of and still the error is same i.e. "Dereferencing the NULL Reference"

Not sure where I am going wrong.Please if anyone can help on same.

Thanks,

Best Regards,

Raina