例として、1回の呼び出しで100個の新しい商品を作成したい場合、最も簡単な方法は、$ batch要求を使用して100個のPOST呼び出しすべてを単一のサービス呼び出しにまとめることです。

URIの末尾にsap-statistics = trueオプションを追加すると、所要時間についての詳細が表示されます。 SAPゲートウェイのパフォーマンストレースで結果を調べることができます。

(Transaction:/ n/iwfnd/traces or /niwbep/traces)

SAP Gateway Side

メソッドCHANGESET_BEGINを使用すると、新しい変更パラメータCV_DEFER_MODEが一度に処理できるゲートウェイフレームワークになります(遅延処理)。 この方法を実行するときの簡単な例を見てみましょう。

  1. Transaction /nsegw
  2. ランタイム成果物を展開します。
  3. dpc_extクラスをダブルクリックして
  4. / IWBEP / IF_MGW_APPL_SRV_RUNTIME〜CHANGESET_BEGINメソッドを見つけて、再定義してください。

その後、これを行うと、CHANGESET_BEGINメソッドは/ IWBEP / IF_MGW_APPL_SRV_RUNTIMEインターフェースから継承されます。

 METHOD /iwbep/if_mgw_appl_srv_runtime~changeset_begin. 

    LOOP AT it_operation_info INTO DATA(ls_operation_info).
IF ( ls_operation_info-entity_set EQ 'YourEntitySet' AND
ls_operation_info-entity_type EQ 'YourEntity' ).
cv_defer_mode = abap_true.
EXIT.
ENDIF.
ENDLOOP. ENDMETHOD.

  

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_PROCESS

  METHOD /iwbep/if_mgw_appl_srv_runtime~changeset_process.

 DATA: ls_changeset_request     TYPE /iwbep/if_mgw_appl_types=>ty_s_changeset_request,
ls_changeset_req_parent TYPE /iwbep/if_mgw_appl_types=>ty_s_changeset_request,
lo_create_context TYPE REF TO /iwbep/if_mgw_req_entity_c,
lv_entity_type TYPE string,
ls_changeset_response TYPE /iwbep/if_mgw_appl_types=>ty_s_changeset_response,
ls_changeset_resp_parent TYPE /iwbep/if_mgw_appl_types=>ty_s_changeset_response,
ls_item TYPE zcl_example_mpc=>ts_item,
lv_error_entity TYPE string,
lt_return TYPE STANDARD TABLE OF bapiret2. DATA lo_container TYPE REF TO /iwbep/if_message_container.
DATA lr_return TYPE REF TO bapiret2.
DATA lv_process_count TYPE i.
DATA lv_isapproved TYPE xfeld.
DATA lv_pending_status TYPE xfeld. **halilu 20.08.2018 16:50:56 ZCL_''_EXT==CM009 LOOP AT it_changeset_request INTO ls_changeset_request. ** You need to pass it if operation_type is 'PE', because
** $batch comes with unnecessary scenarios, you need to avoid it. IF ls_changeset_request-operation_type EQ 'PE'.
CONTINUE.
ENDIF. lo_create_context ?= ls_changeset_request-request_context.
lv_entity_type = lo_create_context->get_entity_type_name( ). REFRESH : lt_return. * Authority Control if you have a authority scenario, you can code in here. *--------------------------------------------------------------------* *--------------------------------------------------------------------* CASE lv_entity_type.
*--------------------------------------------------------------------*
WHEN 'YourEntity'. CLEAR ls_item. ls_changeset_request-entry_provider->read_entry_data( IMPORTING es_data = ls_item ). ** In here , you can implement your logic in a specific customers requirements. ** Your code have to return bapiret2_tt parameter as export,
** Because you need to handle errors in here like below. LOOP AT lt_return TRANSPORTING NO FIELDS WHERE type EQ 'E'. ENDLOOP. IF sy-subrc EQ 0. READ TABLE lt_return REFERENCE INTO lr_return INDEX 1. IF sy-subrc EQ 0 AND
lr_return IS BOUND. lo_container = me->mo_context->get_message_container( ). lo_container->add_message_from_bapi(
EXPORTING
is_bapi_message = lr_return->*
iv_message_target = ls_item-your_key && 'Where you receive errors'
). ENDIF. RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>business_error
message_container = lo_container. ELSE. copy_data_to_ref(
EXPORTING
is_data = ls_item
CHANGING
cr_data = ls_changeset_response-entity_data ). ENDIF.
*--------------------------------------------------------------------* ENDCASE. ls_changeset_response-operation_no = ls_changeset_request-operation_no.
INSERT ls_changeset_response INTO TABLE ct_changeset_response. ** If you do something when batch operation finishes, do something like below. AT LAST. ** Your Logic ** ENDAT. ENDLOOP. ENDMETHOD.

  

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_END

 METHOD /iwbep/if_mgw_appl_srv_runtime~changeset_end.

  COMMIT WORK AND WAIT.

 ENDMETHOD.

  

SAP Ui5 Side

最初に、以下のようにoDataModelを設定する必要があります。

	var oConfig = {
metadataUrlParams: {},
json: true,
// loadMetadataAsync : true,
defaultBindingMode: "OneWay",
defaultCountMode: "None",
useBatch: true
}; // Create and set domain model to the component
var oModel = new sap.ui.model.odata.v2.ODataModel(sServiceUrl, oConfig);
this.setModel(oModel);

  

その後、必要に応じて$ batch処理を実装できます。 私はそれのすべてをsap.m.tableを書かなかった、あなたはこのリンクでそれをチェックすることができる。

SAPUI5 Explored

In your view , you need to bind oViewModel that is a json Model like this.
<Table id="yourTableId" items="{ path: 'oViewModel>/yourArray' }" class="sapUiSizeCompact">

  

コントローラで、onInit関数でoViewModelをインスタンス化します。

	this_oView = this.getView();
var oViewModel = new sap.ui.model.json.JSONModel({
yourArray: [{ "field1" : "data11",
"field2" : "data12",
"field3" : "data13"
},{ "field1" : "data21",
"field2" : "data22",
"field3" : "data23"
}]
}); this._oView.setModel(oViewModel, "oViewModel");

  

	_getViewModel: function() {
var oViewModel = this._oView.getModel("oViewModel");
return oViewModel;
}, yourFunction: function() { debugger; var oModel = this.getView().getModel(),
oTable = this._oTable, // Your Table that you will get item's data.
iLength = oTable.getItems("items").length,
oItem,
sPath,
bError = false; // Distinguish your request from other batch requests like below. oModel.setDeferredBatchGroups(["myId"]); for (var i = 0; i < iLength; i++) { var oEntry = {},
oParams = {}; // You need to show your message that returns from backend the latest. if (i === (iLength - 1)) { oParams.success = function(oData, oResponse) {
sap.ui.core.BusyIndicator.hide();
MessageToast.show(this._oResourceBundle.getText("PROCESS_SUCCESS"));
// debugger; }.bind(this); oParams.error = function(oError) {
// debugger;
sap.ui.core.BusyIndicator.hide();
var oJson = JSON.parse(oError.responseText);
this._bIsError = true;
var oJson = JSON.parse(oError.responseText);
var oMsgBox = sap.ca.ui.message.showMessageBox({
type: sap.ca.ui.message.Type.ERROR,
message: oJson.error.message.value
}); if (!sap.ui.Device.support.touch) {
oMsgBox.addStyleClass("sapUiSizeCompact");
} oModel.refresh(); }.bind(this); } oParams.async = false;
oParams.batchGroupId = "myId"; oItem = oTable.getItems("items")[i];
sPath = oItem.getBindingContextPath(); // needing to bind yourSpecific Json Model to Table's item aggregation.
// in this scenario,
oEntry = this._getViewModel().getProperty(oItem.getBindingContextPath()); sap.ui.core.BusyIndicator.show(0);
oModel.create("/YourEntitySet", oEntry, oParams);
} if (bError === true) {
return;
} oModel.submitChanges({
groupId: "myId"
});
}

  

参考文献

oData $batch processing

SAP OData $batch processing的更多相关文章

  1. RabbitMQ and batch processing 批提交

    RabbitMQ - RabbitMQ and batch processinghttp://rabbitmq.1065348.n5.nabble.com/RabbitMQ-and-batch-pro ...

  2. (十三)Batch Processing

    In addition to being able to index, update, and delete individual documents, Elasticsearch also prov ...

  3. 13 Stream Processing Patterns for building Streaming and Realtime Applications

    原文:https://iwringer.wordpress.com/2015/08/03/patterns-for-streaming-realtime-analytics/ Introduction ...

  4. 【ABAP系列】SAP ABAP 的替代和校验

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP 的替代和校验 ...

  5. Spring Batch 中文参考文档 V3.0.6 - 1 Spring Batch介绍

    1 Spring Batch介绍 企业领域中许多应用系统需要采用批处理的方式在特定环境中运行业务操作任务.这种业务作业包括自动化,大量信息的复杂操作,他们不需要人工干预,并能高效运行.这些典型作业包括 ...

  6. 腾讯大数据平台Oceanus: A one-stop platform for real time stream processing powered by Apache Flink

    January 25, 2019Use Cases, Apache Flink The Big Data Team at Tencent     In recent years, the increa ...

  7. An Overview of End-to-End Exactly-Once Processing in Apache Flink (with Apache Kafka, too!)

    01 Mar 2018 Piotr Nowojski (@PiotrNowojski) & Mike Winters (@wints) This post is an adaptation o ...

  8. Coursera, Big Data 3, Integration and Processing (week 4)

    Week 4 Big Data Precessing Pipeline 上图可以generalize 成下图,也就是Big data pipeline some high level processi ...

  9. Spring Batch 批量处理策略

    为了帮助设计和实现批量处理系统,基本的批量应用是通过块和模式来构建的,同时也应该能够为程序开发人员和设计人员提供结构的样例和基础的批量处理程序. 当你开始设计一个批量作业任务的时候,商业逻辑应该被拆分 ...

随机推荐

  1. 运维监控---企业级Zabbix详解_【all】

    基础LNMP环境搭建 Linux 下LNMP环境搭建 下载Zabbix 链接:https://pan.baidu.com/s/1n36esVyYAKstwnFopbV2sg 密码:izll 创建zab ...

  2. December 14th 2016 Week 51st Wednesday

    Everything has its time and that time must be watched. 万物皆有时,时来不可失. Everything has its time, and I r ...

  3. ZT C/C++变量命名规则,个人习惯总结

    C/C++变量命名规则,个人习惯总结 (2012-10-31 13:48:10) 转载▼ 标签: c/c变量命名规则 c语言变量命名 c变量命名 规则规范 it 分类: C/VC C_C++变量命名规 ...

  4. 021.2 IO流——字节输出流

    内容:流的分类,文件写入(字节输出流),异常处理,获取一个文件夹下的特定文件集合 字节流的抽象基类:InputStream,OutputStream字符流的抽象基类:Reader,Writer由这四个 ...

  5. 配置Ceph集群为OpenStack后端存储

    配置Ceph存储为OpenStack的后端存储 1  前期配置 Ceph官网提供的配置Ceph块存储为OpenStack后端存储的文档说明链接地址:http://docs.ceph.com/docs/ ...

  6. 【LeetCode每天一题】Remove Duplicates from Sorted Array II(移除有序数组中重复的两次以上的数字)

    Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twic ...

  7. EF中連表查詢的應用方式

    1.首先我們想讓列表頁顯示兩個表的共同數據 這裡有兩張表 public class mytype    {        public int mytypeID { get; set; }       ...

  8. Nexus修改admin密码及其添加用户

    Nexus之所以修改密码,是为了安全起见,个人学习的话,本地windows或者虚拟机即可,外网服务器建议将密码修改复杂点,而且强烈建议端口不要8081,最好将其改为其他的.同样也是为了安全起见. 添加 ...

  9. Dubbo实践(二)架构

    架构 节点角色说明 节点 角色说明 Provider 暴露服务的服务提供方 Consumer 调用远程服务的服务消费方 Registry 服务注册与发现的注册中心 Monitor 统计服务的调用次数和 ...

  10. idea 和 maven学习

    创建maven项目:http://www.cnblogs.com/wql025/p/5215570.html