on 2022 Mar 01 2:46 PM
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
Hi,
Please check Method CHANGESET_BEGIN
You should set the changing parameter CV_DEFER_MODE to ABAP_TRUE.
Regards
Thorsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
12 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.