使用する
次のサンプルプログラムは、同期BAPI呼び出しでレシーバーがどのように決定されるかを示しています。
フィルタオブジェクトタイプは実行時に不明です
* data declarationdata:filterobj_values like bdi_fobj occurs 0,filterobj_types like bdi_fobjtype occurs 0,bapi_server like bdbapidest 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 = 'GETDETAIL'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_SYNC_BAPI_GET_RECEIVER'exportingobject = 'BUS1001'method = 'GETDETAIL'tablesreceivers = bapi_serverfilterobjects_values = filterobj_valuesexceptionserror_in_filterobjects = 1error_in_ale_customizing = 2.* call synchronous BAPI locally/remotelyif sy-subrc = 0.if not bapi_server[] is initial.loop at bapi_server.call function 'BAPI_MATERIAL_GET_DETAIL'destination bapi_server-rfc_dest...endloop.else.call function 'BAPI_MATERIAL_GET_DETAIL'...endif.endif.
フィルタオブジェクトタイプは実行時に既知です
* data declarationdata:filterobj_values like bdi_fobj occurs 0,filterobj_types like bdi_fobjtype occurs 0,bapi_server like bdibapidest occurs 0.* fill filterobject values into table filterobj_values-objtype = 'KKBER'.filterobj_values-objvalue = '0002'.append filterobj_values.* get receiver from ALE distribution modelcall function 'ALE_SYNC_BAPI_GET_RECEIVER'exportingobject = 'BUS1010'method = 'GETSTATUS'tablesreceivers = bapi_serverfilterobjects_values = filterobj_valuesexceptionserror_in_filterobjects = 1error_in_ale_customizing = 2.* call synchronous BAPI locally/remotelyif sy-subrc <> 0.if not bapi_server[] is initial.loop at bapi_server.call function 'BAPI_DEBITOR_CREDITACC_GETSTATUS'destination bapi_server-rfc_dest...endloop.else.call function 'BAPI_DEBITOR_CREDITACC_GETSTATUS'...endif. endif.