SAPUI5-批处理操作-如何正确执行? [英] SAPUI5 - Batch Operations - how to do it right?
问题描述
我在SAP后端中有多个要更新的EntititySets,因此我将数据(有效负载)作为JSON提取并放入请求中(成功在数据"节点中):
I got multiple EntititySets which I want to update in my SAP Backend, therefore I fetch my data (payload) as JSON and put it in a request (its successfully in the node "data"):
代码:
var oTreeJSON = oTreeTable.getModel().getProperty("/root");
var oModel = sap.ui.getCore().getModel();
var batchChanges = [];
for (var i = 0; i < oTreeAll.length; i++) {
batchChanges.push(oModel.createBatchOperation("/sap/opu/odata/sap/MY_SERVICE/?$batch", "POST", oTreeAll[i]));
}
oModel.submitBatch();
我的请求如下:
它应该到达SAP的什么位置(哪种方法)?我在做什么错,哪里都没有错误,但是没有电话接到我的后端……对每一个提示都很高兴!谢谢.
Where should it arrive in SAP (which method)? What am I doing wrong, there is no error anywhere, but no call arrived in my backend... Glad about every hint! Thanks.
工作示例,降低了复杂性:
var oEntry = {};
oEntry.MyId = "00000001";
oEntry.Value = "300";
batchChanges.push(oModel.createBatchOperation("MyEntitySet", "POST", oEntry, null));
oModel.addBatchChangeOperations(batchChanges);
oModel.setUseBatch(true);
oModel.submitBatch();
为进行记录,方法调用:
For the record, method calls:
- 1)/IWBEP/IF_MGW_CORE_SRV_RUNTIME〜CHANGESET_BEGIN:SAP投标退出.
- 2)/iwbep/if_mgw_appl_srv_runtime〜create_entity. (n次)//做你的 实体的东西
- 3)/iwbep/if_mgw_core_srv_runtime〜changeset_end:SAP提案提交 工作.
- 1) /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_BEGIN: SAP Proposal EXIT.
- 2) /iwbep/if_mgw_appl_srv_runtime~create_entity. (n-times) // do your stuff with the entity
- 3) /iwbep/if_mgw_core_srv_runtime~changeset_end: SAP Proposal COMMIT WORK.
推荐答案
oModel.addBatchChangeOperations(batchChanges);
oModel.setUseBatch(true);
如果您需要在后端为批处理操作设置一个断点,只需在方法CHANGESET_BEGIN
或CHANGESET_END
中设置一个断点.
In case you need set a breakpoint in backend for batch operations, just set a break point in method CHANGESET_BEGIN
or CHANGESET_END
.
这篇关于SAPUI5-批处理操作-如何正确执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!