ABAP中有关BAPI的介绍
1.BAPI – business application programming interface
2.它实际上是一种特殊的Remote Function Modules (RFC)是为了提供使用外部程序来进行交易活动
3.它提供的基于企业目标(Business Object) 技术的接口应用界面
4.SAP采用了Object-oriented技术,逻辑定义了SAP R/3系统的所有功能目标,并且将所有的目标(Objects) 和BAPIs存储于企业目标库BOR(Business Objects Repository).
5.SAP R/3 企业目标的目标类型(Object Type) 相当于目标设计语言中类(Class) 的概念,其定义结构由以下几部分组成:基本数据,接口界面,键(Key Fields),方法(Methods),特征(Attributes),事件(Events)
--如何创建BAPI程序
1.定义BAPI Structure (Structure不能在BAPI中重复使用,因为一旦BAPI被释放,其Structure被冻结)
2.创建FUNCTION MODULE
每个BAPI必须有自己的Function Group,Function Group属性必须为RFC
3.创建Business Object
4.使用BAPI WIZARD创建API Method
这样BAPI可以被外部程序调用
5.Function Module符合BOR Method
4.释放BAPI Function Module,
释放Business Object Type,
释放BAPI作为BOR的一种Method
示例代码如下:
Calling a BAPI From within the R/3 system
report zwes_test_bapi.
parameters order like bapivbeln-vbeln.
data: return like bapireturn,
statusinfo like standard table of bapisdstat initial size 0.
call function 'BAPI_SALESORDER_GETSTATUS'
exporting
salesdocument = order
importing
return = return
tables
statusinfo = statusinfo.
if return-type = 'S'.
* Process the returned information
else.
write: 'Error:', return-message.
endif.
report zwes_test_bapi.
parameters order like bapivbeln-vbeln.
data: return like bapireturn,
statusinfo like standard table of bapisdstat initial size 0.
call function 'BAPI_SALESORDER_GETSTATUS'
destination 'HP2'
exporting
salesdocument = order
importing
return = return
tables
statusinfo = statusinfo.
if return-type = 'S'.
* Process the returned information
else.
write: 'Error:', return-message.
endif.
Dim CompanyCode As Object
Set CompanyCode = BapiControl.GetSAPObject(ObjectName, _
"1234", "COMP_CODE"))
CompanyCode.ZCCGetDetail Return:=Result, CompanyList:=Detail
浙公网安备 33010602011771号