cancel
Showing results for 
Search instead for 
Did you mean: 

Batch call does not invoke CHANGESET_PROCESS method

pietrom_
Explorer
0 Kudos
891

Hello,
I need to manage a batch request made of two Read Set requests of two different entities inside the CHANGESET_PROCESS method. I need to process the batch as a whole because my backend functionality reads both EntitySets' data in one time.

On my SAPUI5 front end application I have something like this:

                oModel.setUseBatch(true); 
                oModel.setDeferredGroups(["grpTest"]);

                var aFilter = [];
                aFilter.push(new Filter("myFilter", FilterOperator.EQ, "12345678"));

                oModel.read("/FirstEntitySet", {
                    filters: aFilter,
                    and: true,
                    groupId: "grpTest",
                    success: function (oResult, oResponse) {
                        resolve(oResult);
                    }.bind(this), error: function (error) {
                        reject(error);
                    }
                });

                oModel.read("/SecondEntitySet", {
                    filters: aFilter,
                    and: true,
                    groupId: "grpTest",
                    success: function (oResult, oResponse) {
                        resolve(oResult);
                    }.bind(this), error: function (error) {
                        reject(error);
                    }
                });

                // Batch call
                oModel.submitChanges({
		groupId: "grpTest",
                    success: function (oResponse) {
                        oModel.setUseBatch(false); // Attivo modalità batch
                        // debugger;                        
                    }, 
                    error: function (oError) {
                        oModel.setUseBatch(false); // Attivo modalità batch
                        // debugger;
                    }
                });

The request is sent out like this:

--batch_5bbe-7df5-bb66
Content-Type: application/http
Content-Transfer-Encoding: binary

GET FirstEntitySet?sap-language=IT&$filter=myFilter%20eq%20%2712345678%27 HTTP/1.1
sap-cancel-on-close: true
Cache-Control: max-age=7200
sap-contextid-accept: header
Accept: application/json
Accept-Language: it-IT
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0

--batch_5bbe-7df5-bb66
Content-Type: application/http
Content-Transfer-Encoding: binary

GET SecondEntitySet?sap-language=IT&$filter=myFilter%20eq%20%2712345678%27 HTTP/1.1
sap-cancel-on-close: true
Cache-Control: max-age=7200
sap-contextid-accept: header
Accept: application/json
Accept-Language: it-IT
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0

--batch_5bbe-7df5-bb66--

But when the backend process the request, it manages it as two distinct GET_ENTITYSET calls and the CHANGESET_PROCESS method is not called.

Am I missing something?
Thanks,
Pietro

View Entire Topic
ThorstenHoefer
Active Contributor
0 Kudos

Hi,

Please check Method CHANGESET_BEGIN

You should set the changing parameter CV_DEFER_MODE to ABAP_TRUE.

https://help.sap.com/saphelp_snc700_ehp04/helpdata/de/05/fb2651c294256ee10000000a445394/content.htm?...

Regards
Thorsten

pietrom_
Explorer
0 Kudos

Hi Thorsten
the parameter CV_DEFER_MODE is already set to ABAP_TRUE in the CHANGESET_BEGIN method.

vneecious
Product and Topic Expert
Product and Topic Expert
0 Kudos

I’m afraid this doesn’t work for retrieving (read entity and read entityset) unless your working on an embedded gateway