Object-Oriented Access to BAPIs 

Purpose

Object-oriented access to BAPIs in the BOR is possible from a number of platforms.

Development Tool /Middleware

Further Information

BAPI ActiveX Control

(Windows 95 and Windows NT)

SAP’s BAPI ActiveX Control allows external client applications to access SAP business objects in the BOR by invoking BAPIs through OLE Automation. For more information see BAPI ActiveX Control.

BAPI C++ Class Library in SAP Assistant

A BAPI C++ Class Library is available in the SAP Assistant providing a C++ proxy class for each SAP business object and its BAPIs.

For further information see The C++ BAPI Proxy Classes in the SAP Assistant documentation.

BAPI Java Class Library in SAP Assistant

A dynamic BAPI Java Class Library is available in SAP Assistant enabling object-oriented access to BAPIs from Java platforms. To call BAPIs, the standard data types and classes in Java can be used instead of the SAP internal data types and structures.

For further information see The Java BAPI Proxy Classes in the SAP Assistant documentation.

R/3 DCOM Component Connector

(Windows NT)

The R/3 DCOM Component Connector developed jointly by SAP and Microsoft enables seamless integration of R/3 objects and COM objects. SAP business objects and their BAPIs can be accessed transparently from COM-based development tools. The other way round COM components can be accessed from the SAP development environment.

The R/3 DCOM Component Connector Software Development Kit (SDK) is shipped as part of RFC SDK for Windows NT.

For more information see The DCOM Connector.

ObjectBridge
from Visual Edge

Visual Edge’s middleware product "ObjectBridge" enables automatic access to BAPIs from all CORBA 2.0-enabled Object Request Brokers (ORBs) as well as from other object-oriented protocols such as ActiveX/DCOM.

For further details see the ObjectBridge product information.

Programming Environment

Further Information

Delphi/Connect for SAP from Inprise

For further details see Delphi/Connect product information.

Access Builder for SAP R/3 from IBM

Access Builder for SAP R/3 is used to integrate BAPIs into IBM’s development environment, Visual Age for Java. Access Builder for SAP R/3 enables the development of BAPI-enables Java applications, Java applets and JavaBeans for the R/3 System.

For further details see the product information for Access Builder for SAP R/3.

Visual Studio (Enterprise Edition)
from Microsoft

From now on BAPIs implemented in R/3 Releases 3.1H and 4.0A will be available locally from Microsoft’s development environment Visual Studio (Enterprise Edition).

Process Flow

Applications run differently on different development environments and the steps required to start them are also different.

The example below shows the steps involved when the BAPI ActiveX Control is used to access BAPIs. When the R/3 System is connected to, the client application accesses the SAP business objects at runtime by forwarding the OLE automation requests to the BAPI ActiveX Control.

The steps are:

Set oBAPICtrl = CreateObject("SAP.BAPI.1")

Set oLogonCtrl = CreateObject("SAP.Logoncontrol.1")

Set oBAPICtrl.Connection = oLogonCtrl.NewConnection

If oBAPICtrl.Connection.Logon(frmStart.hwnd,FALSE) = FALSE then
MsgBox"R/3 Connection failed"
End
Endif

Before your application can invoke a BAPI on an SAP Business Object, it must first request the creation of an instance of the object.

The command below taken from a Visual Basic program uses the BAPI ActiveX Control object and the GetSAPObject() method to request the creation of an instance of the business object SalesOrder.

Set boOrder = oBAPICtrl.GetSAPObject("SalesOrder")

Set oOrderHeader = oBAPICtrl.DimAs(boOrder, _
"CreateFromDat1", "OrderHeaderIn")

Set otabItems = oBAPICtrl.DimAs(boOrder, _
"CreateFromDat1", "OrderItemsIn")

Set otabPartners = oBAPICtrl.DimAs(boOrder, _
"CreateFromDat1", "OrderPartners")

Then the relevant data must be entered in the parameter objects.

Once the object instance is created, the BAPIs can be invoked on it.

The Visual Basic command below calls a BAPI:

boOrder.CreateFromDat1 OrderHeaderIn:=oOrderHeader, _
OrderPartners:=otabPartners, _
OrderItemsIn:=otabItems, _
Return:=oReturn

The graphic below illustrates how SAP business objects and their BAPIs are accessed via BAPI ActiveX Control.

Using BAPI ActiveX Control