nihaogirl 发表于 2019-2-2 14:47:56

SAP BAPI的一些初级资料

周围的人都比较忙,一切得靠自己学,慢慢摸索。  BAPI有的是类,有的是函数。'Business application programming interface'的简称。
  BAPI is 'Business application programming interface', similar to API. which are stable, standardized methods to access data in R/3
  To use BAPIs to access SAP business objects you will need a good understanding of object-oriented programming. You should also have a basic knowledge of the R/3 System.
  BAPIs can be accessed from various programming environments, for example, Delphi/Connect from Inprise (formerly Borland), Microsoft’s Visual Studio, C++ and Java platforms. You must be familiar with the development environment used to access BAPIs.
  BAPIs are available from development platforms external to R/3 that support the Remote Function Call (RFC) protocol. If you are developing your application in a non-object oriented programming language, you need to have RFC programming skills to call BAPIs via RFC. In particular, you need to know how to perform RFC calls.
  ==========
  BAPI的简单实现步骤
  一,创建Function Module
  1,在SM11,创建需要的structure
  2,在SE80,建Function group
  3,在SE37,创建Function Module
  Note:一个Function Group只能包含一个BAPI;参数传值;必须有有一个BAPIRETURN类型的EXPORT参数
  二,封装
  1,在SWO1,建Object Type
  2,把Function Module作为一个Method加入,utilities->API Methods->Add Method
  3,release Object和Module。使在BAPI Browser 中可以看到。也就是外部能够调用。
  三,调用
  1,如在另一系统中用ABAP调用,先在SM59中建RFC联到有BAPI的R/3,(ZGOGO)
  在SE38的程序中调用,Call Function "ZBAPIXXXXX" DESTINATION ZGOGO EXPORTING ...
  2,如用JAVA调用
  引入包;(不一定要用IBM的)
  import com.sap.rfc.*;
  import com.sap.rfc.exception.*;
  import com.ibm.sap.bapi.*;
  import com.ibm.sap.bapi.generated.*;
  建立连接;调用。。。(See CALL_BAPI.java)
  VBA for SAP
  Private Sub CommandButton1_Click()
  Set oFunction = CreateObject("SAP.LogonControl.1")
  Set oConnection = oFunction.NewConnection
  oConnection.Client = "500"
  oConnection.Language = "EN"
  oConnection.User = "user"
  oConnection.Password = "pasword"
  oConnection.ApplicationServer = "sap1.yok.com.cn"
  oConnection.SystemNumber = "01"
  result = oConnection.Logon(0, True)
  Set ofun = CreateObject("SAP.FUNCTIONS")
  Set ofun.Connection = oConnection
  Set func = ofun.Add("RFC_READ_TABLE")
  func.Exports("QUERY_TABLE") = "MARA"
  If func.Call = True Then
  Set oline = func.tables.Item("DATA")
  Row = oline.rowcount
  i = 1
  Do While i
页: [1]
查看完整版本: SAP BAPI的一些初级资料