使用する
次のサンプルプログラムは、非同期BAPI呼び出しでレシーバーがどのように決定されるかを示しています。
-
フィルタオブジェクトタイプは実行時に不明です
-
ビジネスアドインによる受信者の決定
-
フィルタオブジェクトタイプは実行時に既知です
フィルタオブジェクトタイプは実行時に不明です
* data declarationdata:filterobj_values like bdi_fobj occurs 0,filterobj_types like bdi_fobjtype occurs 0,bapi_logsys like bdi_logsys occurs 0.constants:c_objtype_plant type c value 'WERKS',c_objtype_langu type c value 'SPRAS'.* get filterobjects from ALE distribution modelcall function 'ALE_BAPI_GET_FILTEROBJECTS'exportingobject = 'BUS1001'method = 'REPLICATEDATA'loop at filterobj_types.tablesfilterobjects = filterobj_typesexceptionserror_in_ale_customizing = 1.* fill filterobject values into tableloop at filterobj_types.case filterobj_values-objtype.when c_objtype_plant.filterobj_values-objtype = c_objtype_plant.filterobj_values-objvalue = '0002'.when c_objtype_langu.filterobj_values-objtype = c_objtype_langu.filterobj_values-objvalue = 'D'.when others.endcase.append filterobj_values.endloop.* get receiver from ALE distribution modelcall function 'ALE_ASYNC_BAPI_GET_RECEIVER'exportingobject = 'BUS1001'method = 'REPLICATEDATA'tablesreceivers = bapi_logsysfilterobject_values = filterobj_valuesexceptionserror_in_filterobjects = 1 error_in_ale_customizing = 2.* call generated ALE interface function moduleif sy-subrc <> 0. if not bapi_logsys[] is initial.call function 'ALE_MATERIAL_REPLICATE_DATA'tablesreceivers = bapi_logsys...commit work.endif.endif.
ビジネスアドインを使用した受信者の決定
SAPによって実装されたフォームルーチン
* FORM ALE_BFA_TEST_RECEIVERSFORM ale_bfa_test_receivers TABLES receivers STRUCTURE bdi_logsys USING object TYPE swo_objtyp method TYPE swo_method key1 LIKE tbbfatest-key1 key2 LIKE tbbfatest-key2 return_info LIKE syst. * key1 and key2 are parameters regarding receiver determination * 2 filter object types were defined by SAP: * TEST_KEY1 * TEST_KEY2 * variables definition DATA:w_filter_object_type TYPE bdi_flttyp, t_filter_object_type TYPE bdi_flttyp_tab, w_filter_object_value TYPE bdi_fobj,t_filter_object_value TYPE bdi_fobj_tab,receivers_output LIKE bdi_logsys OCCURS 0 WITH HEADER LINE. CLASS: cl_ex_customer_filter DEFINITION LOAD. DATA:my_exit TYPE REF TO if_ex_customer_filter.*> Step 1) get filter object types for a BAPI CALL FUNCTION 'ALE_BAPI_GET_FILTEROBJECTS' EXPORTING object = object method = method TABLES receiver_input = receivers filterobjects = t_filter_object_type EXCEPTIONS error_in_ale_customizing = 1 OTHERS = 2. IF sy-subrc <> 0. return_info = syst. EXIT. ENDIF.*> Step 2) evaluate SAP filter objects LOOP AT t_filter_object_type INTO w_filter_object_type.CASE w_filter_object_type-objtype.* evaluate delivered filter objectsWHEN 'TEST_KEY1'.MOVE-CORRESPONDING w_filter_object_type TO w_filter_object_value. w_filter_object_value-objvalue = key1. APPEND w_filter_object_value TO t_filter_object_value. WHEN 'TEST_KEY2'. MOVE-CORRESPONDING w_filter_object_type TO w_filter_object_value. w_filter_object_value-objvalue = key2. APPEND w_filter_object_value TO t_filter_object_value. * customers defined filter objects WHEN OTHERS.ENDCASE.ENDLOOP. *> Step 3) evaluate customer-defined filter objects CREATE OBJECT my_exit TYPE cl_ex_customer_filter. CALL METHOD my_exit->filtering EXPORTINGobject = object method = method key1 = key1 key2 = key2 filterobjtype = t_filter_object_type CHANGINGfilterobjvalue = t_filter_object_value. *> Step 4) determine receivers for all filter objects CALL FUNCTION 'ALE_ASYNC_BAPI_GET_RECEIVER' EXPORTING object = object method = method TABLES receiver_input = receivers receivers = receivers_output filterobject_values = t_filter_object_value EXCEPTIONS error_in_filterobjects = 1 error_in_ale_customizing = 2 OTHERS = 3. IF sy-subrc <> 0. return_info = syst. EXIT. ENDIF. receivers[] = receivers_output[]. ENDFORM.
顧客によって実装されたメソッド
The following method was implemented by a customer with * Business Add-In * 1 filter object type was defined by customer: * ZTEST_KEYS METHOD if_ex_customer_filter~filtering. * ... DATA:w_filterobjtype TYPE bdi_flttyp,w_filterobjvalue TYPE bdi_fobj.LOOP AT filterobjtype INTO w_filterobjtype.CASE w_filterobjtype-objtype.WHEN 'ZTEST_KEYS'.MOVE-CORRESPONDING w_filterobjtype TO w_filterobjvalue.w_filterobjvalue-objvalue+0(3) = key1.w_filterobjvalue-objvalue+3(3) = key2.APPEND w_filterobjvalue TO filterobjvalue.WHEN OTHERS.ENDCASE.ENDLOOP.ENDMETHOD.
フィルタオブジェクトタイプは実行時に既知です
* data declarationdata:filterobj_values like bdi_fobj occurs 0,filterobj_types like bdi_fobjtype occurs 0,bapi_logsys like bdi_logsys occurs 0.filterobj_values-objtype = 'KKBER'.filterobj_values-objvalue = '0002'.append filterobj_values.* get receiver from ALE distribution modelcall function 'ALE_ASYNC_BAPI_GET_RECEIVER'exportingobject = 'BUS1010'method = 'REPLICATESTATUS'tablesreceivers = bapi_logsysfilterobject_values = filterobj_valuesexceptionserror_in_filterobjects = 1 error_in_ale_customizing = 2.* call generated ALE interface function module if sy-subrc <> 0. if not bapi_logsys[] is initial.call function 'ALE_DEBITOR_CREDITACC_REPLICATESTATUS'tablesreceivers = bapi_logsys...commit work.endif.endif.