SAP Connectors Integration Technologies Authored by: Kevin Wilson (kevin.wilson@sapgenie.com) Date: 6/1/2002 Author: Kevin Wilson Page 1 /23 TABLE OF CONTENTS CHAPTER 1 SAP CONNECTORS 3 1.1 SAP .NET CONNECTOR -----------3 1.2 SAP JAVA CONNECTOR ----------3 1.3 SAP DCOM CONNECTOR ---------3 1.3.1 COM4ABAP 3 1.4 SAP BUSINESS CONNECTOR ---3 1.5 RFC LIBRARY -------------------------3 CHAPTER 2 .NET CONNECTOR 4 2.1 OVERVIEW ----------------------------- 4 CHAPTER 3 JAVA CONNECTOR 5 3.1 OVERVIEW ----------------------------- 5 CHAPTER 4 DCOM CONNECTOR 6 4.1 OVERVIEW ----------------------------- 6 4.2 FEATURES ----------------------------- 6 4.3 TECHNOLOGY ------------------------6 4.4 ARCHITECTURE ---------------------7 4.5 TRANSACTIONAL MODEL --------7 4.5.1 TRANSACTION MODEL FOR BAPIS 7 4.5.1.1 BAPIs From Release 3.x 8 4.5.1.2 BAPIs From Release 4.0 Onwards 8 4.5.2 TRANSACTION MODEL FOR RFC 8 4.5.2.1 Synchronous RFC 8 4.5.2.2 Transactional RFC 8 4.5.2.3 Queued RFC 8 4.6 RESOURCE POOLING -------------8 4.6.1 RFC CONNECTIONS 8 4.7 THE OBJECT BUILDER ------------9 4.7.1 STRUCTURE 9 4.7.2 PREREQUISITES 9 4.7.3 PROCEDURE 9 4.7.4 THE GENERATION PROCESS 9 4.7.4.1 Project Source Files 10 4.7.4.2 Object Type Source Files 10 4.7.4.3 Structure Type Source Files10 4.7.4.4 Files Generated by Compiling and Linking 11 4.8 PROGRAMMING CLIENTS FOR BAPIS IN VB ----------------------------------- 11 4.8.1 PREREQUISITES 11 4.8.2 PROCEDURE 11 4.8.2.1 Example 11 4.8.3 THE IDOC RFC PROXY 12 4.8.3.1 Use 12 4.8.3.2 Structure 12 4.8.3.3 Integration 12 Author: Kevin Wilson Page 2 /23 CHAPTER 5 COM4ABAP 13 5.1 OVERVIEW ---------------------------13 CHAPTER 6 BUSINESS CONNECTOR14 6.1 OVERVIEW ---------------------------14 6.1.1 FOR MORE INFORMATION 14 6.2 ARCHITECTURE --------------------14 6.2.1 PLATFORMS 15 6.3 HARDWARE REQUIREMENTS -15 6.4 SOFTWARE REQUIREMENTS -15 6.5 BUSINESS CONNECTOR --------16 6.5.1 RFC SERVER / LISTENER 16 6.5.2 MESSAGE STORE 16 6.5.3 THE PARTNER MANAGER 16 6.5.3.1 Routing Rules 17 6.5.4 SECURITY FEATURES 17 6.5.5 GUARANTEED DELIVERY 17 6.5.6 LOAD BALANCING 17 6.5.7 TECHNICAL USES 18 6.5.7.1 Execute ALE functionality. 18 6.5.7.2 Execute BAPI methods. 18 6.5.7.3 Execute Remote Function Calls 18 6.5.7.4 Call SAP BC services from SAP systems. 18 6.5.7.5 Route SAP business documents (IDocs) 18 6.5.7.6 Web Automation 19 6.5.8 FUNCTIONAL USES 19 6.5.9 STANDARDS 19 6.5.9.1 IDoc-XML and RFC-XML 19 6.5.9.2 BizTalk XML Envelopes 19 6.6 SAP BC INTEGRATOR -----------19 6.6.1 PACKAGES 19 6.6.2 FLOW SERVICES 19 6.6.3 FLOW STEPS 20 6.6.4 THE PIPELINE EDITOR 20 6.6.5 DEBUGGING 20 6.6.6 BUILDING CODED SERVICES 20 6.6.6.1 Building SAP BC Services Using Java 20 6.6.6.2 Creating Client Code 21 6.6.6.3 Accessing Databases with SAP BC 21 CHAPTER 7 RFC LIBRARY 22 7.1 OVERVIEW ---------------------------22 APPENDIX A. GLOSSARY 23 CHAPTER 1 SAP CONNECTORS The SAP Connectors allow the integration of different applications and technologies with SAP Systems via open standards. The connectors are means for technical interoperability of SAP Components (written in ABAP or ABAP Objects) and other components (e. g. written in Java, C++, Visual Basic, .NET, etc.). 1.1 SAP .NET CONNECTOR The SAP .NET Connector offers developers the possibility to expose BAPIs and remotelyenabled function modules to any .NET application (inside-out). It is also possible to access .NET components from any mySAP.com application (outside-in). 1.2 SAP JAVA CONNECTOR The SAP Java Connector (SAP JCo) is a toolkit that allows a Java application to communicate with any SAP system. It combines an easy to use API with unprecedented flexibility and performance. The package supports both, Java to SAP System as well as SAP System to Java calls. 1.3 SAP DCOM CONNECTOR The DCOM Component Connector is a means for technical interoperability of SAP Components (written in ABAP or ABAP Objects) and COM Components (written in VB, Java, C++, Cobol, Delphi or any other COM-compliant language) on the basis of Microsoft´s Distributed Component Object Model (DCOM). 1.3.1 COM4ABAP com4abap is a multi-thread server that can expose any COM automation interface to an ABAP program and also offers semi-automatic type conversion between ABAP and COM data types. In particular, it allows you to address components that do not have their own user interface. 1.4 SAP BUSINESS CONNECTOR The SAP Business Connector (SAP BC) allows you to highly automate and extend your business processes over the Internet using open and non-proprietary standards. Thus the SAP BC seamlessly integrates different IT architectures with SAP Systems. The SAP BC provides bidirectional, real-time as well as asynchronous communication to and from a SAP System. The SAP BC is a main part of the SAP Internet Initiative. 1.5 RFC LIBRARY The RFC Library offers an interface to a SAP System. The RFC Library is the most commonly used and installed component of existing SAP Software. This interface provides the opportunity to call any RFC Function in a SAP System from an external application. Moreover, the RFC Library offers the possibility to write a RFC Server Program, which is accessible from any SAP System or external application. Most SAP Connectors use the RFC Library as communication platform to SAP Systems. Author: Kevin Wilson Page 3 /23 CHAPTER 2 .NET CONNECTOR 2.1 OVERVIEW The SAP .NET Connector offers developers the possibility to expose BAPIs and remotelyenabled function modules to any .NET application (inside-out). Now it is possible to also access .NET components from any mySAP.com application (outside-in). At design-time the new Proxy Wizard for Visual Studio .NET allows the integration of SAP business data and processes into .NET applications in a very comfortable and intuitive way. The Proxy Wizard will interactively generate proxy classes in C# and add them to your .NET project. You then can access all properties, methods and even table structures from your .NET application independently of your preferred .NET language (C#, VB or any other supported language). Generated code for logon and connecting to an SAP system as well as Intelligence support facilitate the process of building your first application. All this is taking place within the familiar Visual Studio .NET development environment. At run-time the SAP .NET Connector will perform and manage all necessary communication between the .NET application and the SAP server. Transparent for the application both SOAP or SAP RFC can be used as communication protocols. Transactional RFC or queued RFC are supported. For communication security you can use Kerberos, X.509 certificates or Microsoft Passport. Availability Currently, the SAP .NET Connector is a beta product. The release of the final product is planned for the middle of 2002. The SAP .NET Connector works with all SAP application servers starting with release 3.1I, which means access to .NET applications for all existing SAP R/3 systems as well as for the new Web Application Server. Author: Kevin Wilson Page 4 /23 CHAPTER 3 JAVA CONNECTOR 3.1 OVERVIEW The SAP Java Connector is a toolkit that allows a Java application to communicate with any SAP system. It combines an easy to use API with unprecedented flexibility and performance. The package supports both, Java to SAP System as well as SAP System to Java calls. The SAP Java Connector is the best choice for building SAP-enabled Java applications because of the following features: High-performance JNI-based RFC middleware Supports R/3 3.1H and higher (and other mySAP components that have BAPIs or RFMs). Supports inbound (Java client calls BAPI or RFM) and outbound (ABAP calls Java server) calls. Supports synchronous, transactional (important for IDocs), and queued RFC. Supports client pooling (good for web servers). Multi-platform Complete and correct code-page handling (incl. multi-byte languages) Easy to install and deploy. Author: Kevin Wilson Page 5 /23 CHAPTER 4 DCOM CONNECTOR 4.1 OVERVIEW The SAP DCOM Connector, which forms part of the RFC SDK, allows you to expose BAPIs and remotely-enabled function modules as COM components, thus providing an entry point to the R/3 System that you can address using many different programming languages and application environments. From Release 4.6D onwards, the SAP DCOM Connector also contains a generic RFC server, which allows you to address any COM component from within ABAP using a set of special remote function calls. You can use this outbound server in any system from 4.0B upwards. The only requirement is that you first apply a special transport to your system. This transport contains a function group necessary for outbound communications. It is available on request from SAP. 4.2 FEATURES The SAP DCOM Connector allows you to: Create proxy objects that allow you to address BAPIs from within an external program Create proxy objects that allow you to address remote function modules from within an external program, using either synchronous, transactional, or queued RFC Use the generic RFC server Com4Abap to address COM components easily from an ABAP program The SAP DCOM Connector is an early-binding tool, which gives you strong typing at compile time. This also improves runtime performance, since your components do not have to retrieve type information from the R/3 System at this time. The components also provide automatic type mapping between ABAP and automation data types (including conversion of ABAP internal tables into ADO Recordsets). Using the the SAP DCOM Connector and MTS allows you to create distributed applications without having to install the SAP DLL or COM component on each client machine. The components that you create using the Object Builder can be used in the following environments: Visual C++ Visual Basic and VBA Java (Microsoft VM) Active Server Pages VB Script Java Script 4.3 TECHNOLOGY The Distributed Component Object Model (DCOM) enables COM software components to communicate directly over a network in a reliable, secure, and efficient manner. DCOM is designed for use across multiple network transports, including Internet protocols such as TCP and HTTP. DCOM is based on the Open Software Foundation's DCE-RPC spec and will work with both Java™ applets and ActiveX™ components through its use of the Component Object Model (COM). DCOM is a fast, native object transport for Windows NT and Windows ® 95. The Microsoft Transaction Server (MTS) is based on COM and uses DCOM for component-tocomponent communications across a network. MTS itself is a component-based transaction processing system for developing, deploying, and managing high performance, scalable, and robust enterprise, Internet, and Intranet server applications. The MTS defines an application Author: Kevin Wilson Page 6 /23 programming model for developing distributed component-based applications. It also provides a run-time infrastructure for deploying and managing these applications. 4.4 ARCHITECTURE Using the Object Builder, you can create COM components that expose one or more BAPIs or remotely-enabled function modules. Each BAPI or function module in the component appears as a separate method. The Object Builder also adds certain adminstrative methods to the component. Once you have created a component, you can install it in a Microsoft Transaction Server package. You can then use it in your client applications. If you write your client in a language that supports COM, the program can access the package directly. If you write an HTML client (Web application), you must use Active Server Pages (ASP) to run server-side scripts that can communicate with your COM component. 4.5 TRANSACTIONAL MODEL A transaction is an inseparable sequence of database operations that transforms the database from one consistent state to another consistent state. These database operations must operate on the "all or nothing" principle – they must either all be carried out or all be canceled. When you program using the SAP DCOM Connector, it is important to know how the components you are using behave with respect to transactions. The most important question is whether the changes you make are committed automatically, or whether you have to commit them yourself. 4.5.1 Transaction Model for BAPIs When you program against BAPIs using the DCOM Connector, it is important to know whether the function in question is from Release 3.x or from Release 4.0 or higher, since there are differences in the transactional behavior. Author: Kevin Wilson Page 7 /23 4.5.1.1 BAPIs From Release 3.x Up to and including Release 3.1, each BAPI call forms its own transaction, with the system automatically calling the ABAP COMMIT WORK statement at the end of the BAPI. 4.5.1.2 BAPIs From Release 4.0 Onwards From Release 4.0, BAPI calls are no longer automatically committed by the system. Instead, you must commit them using the CommitWork method (equally, you can roll them back using RollbackWork). One practical consequence of this is that you can now combine several BAPI calls into one SAP LUW (transaction), and commit them or roll them back as a block. 4.5.2 Transaction Model for RFC When you create COM components for remotely-enabled function modules, you need to decide between three types of RFC – synchronous, transactional, and queued. 4.5.2.1 Synchronous RFC In synchronous RFC, the client program sends the function call to the R/3 System and waits until it is complete. Some function modules contain their own implicit or explicit commits. In other cases, however, you need to call the CommitWork method yourself. To find out which case applies to a particular function module, refer to its documentation and source code. 4.5.2.2 Transactional RFC If an error occurs during a synchronous remote function call, the system cannot tell at what point the error occurred (most crucially, whether the function module was actually processed in R/3 before the operation failed). Restarting a failed call is therefore a dangerous thing to do, since you risk duplicating a completed function call. To alleviate this problem, you can use transactional RFC, which guarantees that each function call you issue will only be executed once, even if you submit it repeatedly to the R/3 System. The system implements this safeguard by assigning a unique transaction ID (TID) to each transaction that you submit. When you attempt to process the transaction, the system checks whether that TID has already been processed. If it has, the transaction is ignored. 4.5.2.3 Queued RFC When you use transactional RFC, you cannot guarantee the order in which the function calls will be processed in the system (it is quite possible that one call might overtake another). For cases where you need to specify a particular processing order, you can use queued RFC, which is an extension of transactional RFC. In qRFC, you place each function call in a logical queue. A function call cannot be executed until all of its predecessors in the queue have been processed. Queued RFC calls are processed asynchronously. 4.6 RESOURCE POOLING If you choose to use the Microsoft Transaction Server (MTS) with the SAP DCOM Connector, it will automatically take care of resource pooling and thread management for you. This section explains which resources can be pooled by the MTS and the benefit that you gain from this. 4.6.1 RFC Connections Communication between an MTS component and the R/3 System uses Remote Function Call (RFC). Since there is considerable overhead involved in establishing these connections, the MTS does not release a connection as soon as an object has finished with it. Instead, it keeps it in a connection pool. From here, it can be reused by another object. If after a certain period the object has still not been used, the system will release it. Each RFC connection is characterized by the following properties: Target system Client Author: Kevin Wilson Page 8 /23 User name Password Language A pooled resource can only be reused by an object with the same properties. Thus resource pooling is of considerable importance in Web scenarios, where several users share a single R/3 user, because there will be many requests using the same connection parameters. If the MTS can allocate an existing connection to these requests, the performance of the application will be improved, because you no longer have the overhead associated with creating new RFC connections. 4.7 THE OBJECT BUILDER The Object Builder is the part of the SAP DCOM Connector that you use to generate proxy COM objects for BAPIs and remotely-enabled function modules. 4.7.1 Structure The Object Builder contains three parts. In the top-left hand corner of the screen, you log onto the R/3 System containing the BAPIs or function modules for which you want to generate proxies. Below this, the list of objects available for selection is displayed in hierarchical form. On the righthand side of the screen, you set the various options for the C++ project that is created during the generation process. 4.7.2 Prerequisites There must already be a destination that points to the system whose BAPIs or function modules you want to use. You can create this by creating a new destination in the DCOM Connector. 4.7.3 Procedure 1. Select the destination to which you want to log on. Any logon information that has been stored for that destination will automatically appear in the relevant input fields. 2. Fill out any remaining logon details and choose Logon. This connects to the destination. A list of all of the business objects in that system appears. 3. In the COM/MTS group box, enter the name to be assigned to the make file of the C++ project. This name is automatically copied into the Target DLL field as well. 4. Enter a namespace name. The default is the system name, but you can enter any value. It will be the first part of the ProgID of the class. 5. If you want the Object Builder to generate a session object, select the Session Object option. An input field appears, in which a name for the session object is already proposed. 6. Select the RFC type that you want to use. For further information, refer to The Transaction Model. 7. Position the cursor on a business object that you want to include in your COM component and choose Add. Each business object that you select will be a class within the COM object. The BAPIs of the object will be methods of the corresponding class. 8. Choose Build Component DLL. This creates the C++ project and generates the COM component. 9. If you are using Windows 2000 or Windows NT with the Microsoft Transaction Server and want to use the component in the MTS environment, choose Install Component DLL in MTS. 4.7.4 The Generation Process When you generate a COM component using the Object Builder, the DCOM Connector performs two steps: Author: Kevin Wilson Page 9 /23 1. Generating the source files 2. Compiling and linking the DLL During this process, the following source files are generated: 4.7.4.1 Project Source Files Filename Function <project>.mak Project file <project>.cpp Contains the obligatory function DLLMain, as well as other functions for creating object types (from a class factory) and for registration <project>.rc Resource file for the project <project>.idl Interface Definition Langauge (IDL) source containing the interface description. This is needed to generate the type library. The file contains the definitions of all COM interfaces with the corresponding GUIDs for the selected objects of the project. <project>.def DEF file with the exported functions of the DLL <project>AfX.cpp The C++ source file containing standard includes <project>AfX.h Include file for standard includes with type definitions <Project>Res.h This include file is created by Visual Studion. It is required by the resource file Project.rc 4.7.4.2 Object Type Source Files The following files are created for each object type: Filename Function <ObjectType>.cpp Implementation of a proxy object (such as as a business object). Methods of the DCOM Connector Template Library are used to call remote function modules in R/3 <ObjectType>.h The class definition for the corresponding proxy object <ObjectType>.rgs Description of the registry entries to be created (including the ProgID, InterfaceID, user, and system data) 4.7.4.3 Structure Type Source Files The following files are created for each structure type: Filename Function <StructureType>.h Description of the fields of the corresponding ABAP Dictionary structure Author: Kevin Wilson Page 10 /23 4.7.4.4 Files Generated by Compiling and Linking The following files are generated when the DCOM Connector compiles and links the project: Filename Function <project>.h Contains definitions for interfaces and generates headers for interfaces to objects from R/3. It contains data from the IDL file <project>.lib LIB file <project>.log Output from the Microsoft IDL and C++ compilers and linkers is diverted into this file. The LOG file contains details of all errors that occurred during compilation and linking <project>.tlb The type library of the project, containing the interface description exposed by R/3 objects <project>.dll The DLL that is actually installed. Also contains the type library. 4.8 PROGRAMMING CLIENTS FOR BAPIS IN VB Use this procedure to program a VB client that calls BAPIs using a session object. 4.8.1 Prerequisites You must already have created and installed the proxy object and session object. 4.8.2 Procedure 1. 2. 3. 4. 5. 6. Create an instance of the session object. Use the PutSessionInfo method to set the connection parameters for the object. Create instances of the relevant business objects Call the BAPIs that you need Call the CommitWork() method of your session object. Release the objects that you have used. 4.8.2.1 Example The following program retrieves a list of sales orders from an R/3 System and displays them in a Visual Basic program. It should work with any IDES System with Release 4.0B or higher, as long as you change the logon data in the oSession.PutSessionInfo function. The example is contained in a standard EXE project with a single form called Form1. The component T20Saleslib is a DCOM proxy for the business object SalesOrder plus a corresponding session object. The data grid control is called DataGrid1. The Get Sales Orders function is implemented in the routine cmdGet_Click, and the Exit function is implemented in the cmdExit_Click routine. The Source Code Private Sub cmdGet_Click() Dim oSession As New T20salesLib.SalesorderSessionComponent Dim oOrders As Object Dim oOrderList As ADODB.Recordset Dim oReturn As ADODB.Recordset Author: Kevin Wilson Page 11 /23 oSession.PutSessionInfo "T20 [PUBLIC]", "TESTUSER", "LETMEIN", "EN", _"800" Set oOrders = oSession.CreateInstance("T20.SalesOrder.1") oOrders.DimAs "BAPIGETLIST", "SALESORDERS", oOrderList oOrders.DimAs "BAPIGETLIST", "RETURN", oReturn Set oOrderList = oOrders.BapiGetList(CustomerNumber:="0000001000", _ SalesOrganization:="1000", SalesOrders:=oOrders) Set DataGrid1.DataSource = oOrders DataGrid1.Refresh Set oOrders = Nothing Set oSession = Nothing End Sub Private Sub cmdExit_Click() Unload Form1 End Sub 4.8.3 The IDOC RFC Proxy The IDOC RFC Proxy is a special DCOM proxy component that allows you to submit IDOCs from external systems to an SAP System. It calls the R/3 function modules INBOUND_IDOC_PROCESS (in the case of a version 2 IDOC) or IDOC_INBOUND_ASYNCHRONOUS (in the case of a version 3 IDOC). 4.8.3.1 Use You can use this proxy component whenever you need to submit IDOCs from external systems. It thereby eliminates the need to use the C RFC API to do so. You may submit one or more IDOCs in a single call. They should be formatted as a text stream. 4.8.3.2 Structure The component inherits from the transactional RFC interface of the SAP DCOM Connector (ISAPTRfcConnector). Consequently, it supports transactional RFC. To submit the IDOCs, you use the method SubmitIdoc. 4.8.3.3 Integration You can use the IDOC RFC proxy in any of the development environments supported by the SAP DCOM Connector Author: Kevin Wilson Page 12 /23 CHAPTER 5 COM4ABAP 5.1 OVERVIEW Addressing external components using ABAP has never been easy. Although SAP has long provided the RFC API, you needed considerable C expertise to get the server to link and compile properly. Multi-threading was the responsibility of the programmer. Furthermore, you had to ensure tha tthe service would be active when invoked from ABAP. For Visual Basic programmers, the situation was even worse, because in order to communicate with the RFC API, you had to convert the data structures back and forth between the C structures and data types you could actually work with in VB. The aim was to provide a generic RFC server for the Windows environment with which you could address any COM automation interface, both your own and proprietary interfaces such as, for example, MS Exchange. The result is com4abap – a multi-thread server that can expose any COM automation interface to an ABAP program and also offers semi-automatic type conversion between ABAP and COM data types. In particular, it allows you to address components that do not have their own user interface. com4abap can be run as a W2K/Window NT service, or started as an executable. You must also register it as an RFC destination in the client R/3 System. In ABAP, you program against this destination to create a COM session, in which you can instantiate any registered COM component. Author: Kevin Wilson Page 13 /23 CHAPTER 6 BUSINESS CONNECTOR 6.1 OVERVIEW SAP Business Connector is a middleware server application based on webMethods B2B Integration Server. SAP Business Connector allows you to extend your business processes over the Internet and integrate non-SAP products using open, nonproprietary technology. SAP Business Connector provides bidirectional synchronous as well as asynchronous communication to and from applications in your mySAP.com landscape, including SAP and nonSAP components and applications as well as Web applications. Calling SAP Business Connector from within an SAP application is no different from calling any other RFC server. The SAP-proprietary RFC format is converted to Extensible Markup Language (XML) or HyperText Markup Language (HTML) so that no SAP software is needed on the other end of the communication line. Since SAP BC uses both synchronous RFC (BAPI) and asynchronous tRFC (ALE) calls you can use both BAPIs and ALE for communication in your landscape. 6.1.1 FOR MORE INFORMATION For further information on SAP Business Connector, see the documentation on the SAP Service Marketplace at http://service.sap.com/connectors. To download SAP Business Connector and SAP BC Integrator go to http://service.sap.com/sbc-download. 6.2 ARCHITECTURE The architecture of SAP Business Connector (SAP BC) is divided into two independent parts: the server itself, which is the processing component, and SAP BC Integrator. SAP BC Integrator is a Author: Kevin Wilson Page 14 /23 development tool that lets you create custom functionality for one or more SAP Business Connector instances (It will be discussed in the next chapter). 6.2.1 Platforms You can run SAP BC on the following platforms: Windows NT and Windows 2000 Linux Solaris AIX HP-UX 6.3 HARDWARE REQUIREMENTS Minimum Recommended Processor Pentium II 233 MHz or equivalent Memory (RAM) 128 MB 256 MB free disk space 100 MB Depends on the number of transactions stored in the file system; also depends on the number of additional packages and services 6.4 SOFTWARE REQUIREMENTS To use SAP Business Connector, you must have SAP R/3 3.1G or higher, or you must have a mySAP.com license. Additionally, you need one of the following browsers installed either on the machine where SAP Business Connector is installed or on any machine that can access SAP Business Connector through HTTP: Netscape Navigator or Netscape Communicator 6.x Microsoft Internet Explorer 4.0 or later (5.0 is recommended) If you want to create additional Java services, you need to install a Java Development Kit (JDK). No additional software is needed. SAP Business Connector comes with built-in HTTP and FTP server and client functionality. A version of SAP Business Connector including strong 128-bit encryption is available via SAPNet. Author: Kevin Wilson Page 15 /23 6.5 BUSINESS CONNECTOR SAP R/3 SAP Business Connector RFCs tRFCs RFCs RFCs RFC Client SAP BC Services 2. Create client that invokes service 1. Select SAP Component and the RFC to execute BAPIs BAPIs Requests mapped to server RFC tRFC RFC Server (Listener) Message Store IDocs IDocs Requests NOT mapped to server tRFC Partner Manager Rule FTP to a location Rule Send via EMail Rule HTTP post via URL Rule 6.5.1 RFC Server / Listener The SAP BC server listens for client requests on one or more ports. You can associate the type of protocol that the server uses for each port. The server supports HTTP, HTTPS, FTP, and email ports. 6.5.2 Message Store SAP Business Connector provides a persistent message store that the transaction manager uses to track all IDocs and all tRFC calls that are routed to and from SAP components via SAP Business Connector. 6.5.3 The Partner Manager The Partner Manager is a built-in facility on SAP Business Connector that manages the routing of messages. The Partner Manager determines how and where to route a message based on routing rules that you define. Each routing rule is associated with an SAP BC flow service that the Partner Manager generates based on the information in the routing rule. When the Partner Manager receives a message, it looks for a routing rule. After locating the routing rule for the incoming message, the Partner Manager invokes the SAP BC flow service that is associated with the routing rule. The Partner Manager records each message that it receives, recording it in the Message Store as a transaction. By default, the Partner Manager maintains the Message Store in a log file. However, you can configure the Partner Manager to use a database for the Message Store. Author: Kevin Wilson Page 16 /23 You can view and manage the transactions that the Partner Manager records in its Message Store. You can resend messages to the Partner Manager for processing, and you can delete transactions. 6.5.3.1 Routing Rules Routing rules indicate how a message is to be processed. Each routing rule is uniquely identified by its sender, receiver, and message type. When the Partner Manager receives a message, it looks for a routing rule to match the sender, receiver, and message type of the incoming message with the sender, receiver, and message type in the routing rules. If it finds a match, the Partner Manager processes the message in the manner that the routing rule indicates. If it finds no routing rule for the message, the Partner Manager notifies you that the routing rule is incomplete. When you complete the rule, the Partner Manager uses the completed rule to route subsequent messages that have the same sender, receiver, and message type. The routing rule includes transport information that indicates how and where to route a message. The transports that you can specify in the rule allow you to route a message to an SAP BC service, send a message via e-mail, send a message in FTP, route an IDoc to an SAP component via tRFC, route an RFC to an SAP component via RFC, or post an IDoc-XML or RFC-XML to a URL. 6.5.4 Security Features SAP Business Connector is available in two versions, depending on your security needs: A version with weak (40-bit) encryption A version with strong (128-bit) encryption, which is discussed below SAP Business Connector has several built-in security mechanisms to protect services from unauthorized access, to prevent unauthorized administration of SAP Business Connector, and to prevent data from being intercepted during transmission: SAP BC requires clients to present valid credentials – a user name and password or a client certificate – in order to connect to the server. You can control access to individual services by user groups. You do this by using the Access Control Lists (ACLs) mechanism to associate certain groups with a service. You can control access to services based on which listener receives a service request. SAP BC requires clients to present valid credentials for administrator privileges in order to gain access to SAP Business Connector administrator functions. You can configure an administrator listener so that only the administrator listener can accept requests to administer SAP Business Connector. SAP BC supports encrypted conversations through Secure Sockets Layer (SSL). SAP Business Connector can present a different client certificate to each SSL server. 6.5.5 Guaranteed Delivery Guaranteed delivery is a facility of SAP BC that ensures one-time execution of requested SAP BC services. It protects transactional requests from transient failures that might occur on the network, in the client, or on the server. A transient failure is a failure that can correct itself within a specified period of time. With the guaranteed-delivery feature of SAP BC, when a transient failure prevents a request from being delivered to the server, SAP BC resubmits the request. If the problem corrects itself, SAP successfully delivers the request in a subsequent attempt. You can determine what constitutes a transient error by specifying a time-to-live (TTL) period, and you can specify the number of times that SAP BC should retry a transaction. If you do not specify the TTL period or retry number, SAP BC uses the configured defaults. You can use guaranteed delivery when you invoke an SAP BC service from a client or from within another SAP BC service. 6.5.6 Load Balancing Author: Kevin Wilson Page 17 /23 Load balancing is an optimizing feature that you use with clustered servers running SAP Business Connector. Load balancing allows a server to automatically refer a client request to another server if it is too busy to handle the request itself. To use this feature, you use SAP Business Connector Clustering, which uses a central cluster store to maintain the status of SAP BC services running in the cluster. The store is part of SAP Business Connector Repository. 6.5.7 Technical USES You can use BC to accomplish the following: 6.5.7.1 Execute ALE functionality. Your business partners can make requests over the Internet to invoke a service that executes a BAPI. You can use them to trigger a process in asynchronous mode. Asynchronous processing uses the ALE services inside the SAP components transparently for the client. Inside the SAP component, administrators can then use the full services provided by ALE, including: Performance benefits through asynchronous processing Monitoring services Distribution services 6.5.7.2 Execute BAPI methods. You can create XML-based SAP BC services that execute a BAPI. Applications within your organization can then invoke the SAP BC services to execute a BAPI on the SAP server. Similarly, your business partners can make requests over the Internet to invoke a service that executes a BAPI. You can use them to trigger both synchronous and asynchronous processing. Synchronous processing uses the BAPI method of communicating. The Interfaces Repository (IFR) available at http://ifr.sap.com provides public, Web-based access to the collection of BAPI interfaces provided by SAP and to the corresponding documentation. 6.5.7.3 Execute Remote Function Calls You can execute RFCs to access all available SAP functionality. External applications do not need to support SAP data types, ABAP structures, or the RFC protocol to communicate with an SAP component. 6.5.7.4 Call SAP BC services from SAP systems. You can invoke SAP BC services from an SAP component. This allows SAP users to access information via SAP Business Connector. Thus SAP Business Connector enables business-tobusiness integration between trading partners, thereby extending the reach of your SAP infrastructure to customers, partners, and suppliers. Before you can create an RFC that invokes an SAP BC service, you must configure the SAP component to have an RFC destination for a server running SAP Business Connector. This defines the destination to which the SAP component sends RFCs to invoke an SAP BC service. You must also configure SAP Business Connector to have an RFC Server (Listener) that listens for RFCs from your SAP component. After configuring the SAP component and SAP Business Connector, you can create a function module on the SAP component that requests the execution of an SAP BC service. You also need to create an inbound map on SAP Business Connector. The inbound map indicates which service SAP Business Connector is to execute when it receives the RFC from the SAP component. 6.5.7.5 Route SAP business documents (IDocs) SAP Business Connector provides great routing capabilities for IDocs. A number of transport types are available out of the box. For example, you can route an IDoc to another SAP component, to mySAP Enterprise Portals, or simply to a remote URL in an XML format. Author: Kevin Wilson Page 18 /23 6.5.7.6 Web Automation Web Automation is a unique feature of SAP Business Connector. It allows you to retrieve information directly and in real time from Web sites. No browser or manual intervention is needed, and no software integration is needed on your partner’s side. You may process several Web pages and even provide input to forms automatically. You can even handle Web sites that use scripts. A typical application is to download information from several catalogs and then aggregate the results and return them to the SAP business solution. 6.5.8 Functional uses Typical uses for SAP Business Connector are the following: Real-time integration of your suppliers’ inventories with your SAP components Real-time integration of your suppliers’ product, price, and availability information with your purchasing application Real-time integration of your shippers’ internal systems with your fulfillment and ordertracking applications 6.5.9 Standards 6.5.9.1 IDoc-XML and RFC-XML SAP Business Connector is the de facto XML interface to existing SAP component releases. It supports all versions of IDoc-XML and RFC-XML, as specified by the SAP-XML Specification. With the SAP Business Connector SAP-XML interface, you can invoke RFCs via XML and convert IDocs to the SAP-XML format. 6.5.9.2 BizTalk XML Envelopes As a default, SAP Business Connector uses the standardized BizTalk XML envelope format for BAPI and RFC XML messages. This specific XML format, developed by SAP, is called bXML. It simplifies data exchange with other Web-based messaging systems. The BizTalk XML envelope distinguishes between an application specific XML body and a transport-specific XML header. The header communicates transport-specific information – about routing, for example. The BizTalk XML envelope can be used for both BAPI and RFC XML calls and also for both synchronous and asynchronous processing. 6.6 SAP BC INTEGRATOR SAP BC Integrator is an integrated development environment that you use to create SAP BC services for one or several instances of SAP BC. It provides all the tools you need to build and test SAP BC services, generate stubs for client applications, and create output templates. Some of the most commonly used functional elements of SAP BC Integrator are described below. 6.6.1 Packages A package is a container that you use to bundle services and related elements, such as specifications, records, schemas, and output templates. When you create a folder, service, specification, record, schema, or output template, you save it in a package. Packages are designed to hold all the components of a logical unit in an SAP BC component. For example, you might group all the services and files specific to a particular marketplace in a single package. After grouping these components into a single package, you can easily manipulate them as a unit. 6.6.2 Flow Services A flow service is a service that is written in webMethods flow language. This language lets you encapsulate a sequence of SAP BC services within a single service and manage the flow of data among them. For example, you might create a flow service that takes a purchase order from a Author: Kevin Wilson Page 19 /23 buyer and executes the following series of SAP BC services before submitting it to an internal ordering component: Receives a purchase order submitted by a buyer Logs the order in an audit-trail file Performs a credit check Posts the order to the ordering system Any SAP BC service can be invoked by a flow service – including other flow services. For instance, a flow service might invoke a service that you create or any of the built-in services provided by SAP BC. You create flow services using SAP BC Integrator. SAP BC saves them in XML files. 6.6.3 Flow Steps A flow service contains flow steps. A flow step is a basic unit of work, expressed in webMethods flow language, which SAP BC interprets and executes at run time. webMethods flow language provides flow steps that invoke services as well as flow steps that let you edit data in the pipeline. webMethods flow language also provides a set of flow-control steps that allow you to direct the execution of a flow service at run time. The flow-control steps allow you to: Conditionally execute a specified sequence based on a variable value. Retry a specified sequence until it succeeds. Repeat a specified sequence (loop) for each element in an array variable. 6.6.4 The Pipeline Editor The Pipeline Editor is the facility you use to perform mapping and inspect the pipeline. It offers a graphical representation of all your data. You use the tools in the Pipeline Editor to route variables (data) between services or between document formats. 6.6.5 Debugging SAP BC Integrator provides a range of tools to assist you during testing and debugging. For example, you can: Test services, specify their input values, and inspect their results. Examine the call stack and the pipeline when an error occurs. Execute services in debug mode, a mode that lets you monitor a flow service’s execution path and/or execute its steps one at a time. Temporarily disable steps in a flow and/or specify points where you want to halt execution. Additionally, SAP provides tools for collecting run-time information that can help debug a service. These include tools to: Write arbitrary messages to the server log. Trace the pipeline at run time. Modify and save the contents of the pipeline at a specified point. 6.6.6 Building Coded Services In addition to using the built-in services that SAP provides, you can create customized services in a variety of programming languages. You can create a library of custom code that a flow service or a client application can access and execute. 6.6.6.1 Building SAP BC Services Using Java Since Java is the native language of SAP BC services, it is the easiest language in which to build an SAP BC service. Author: Kevin Wilson Page 20 /23 SAP BC Integrator provides an integrated development environment that you can use to create, compile, and publish Java services. The development environment automatically generates an appropriately structured source file that you simply fill in using the built-in editor. When you save the source file, the development environment automatically compiles it and registers it on the SAP BC server. 6.6.6.2 Creating Client Code SAP BC Integrator enables you to automatically generate client code in a variety of languages and for several environments. Client code is application code that invokes a service on SAP BC. It typically performs the following basic tasks: Prompts the user for input values if your service takes input Places the inputs into an input record if your service takes input Opens a session on SAP BC Invokes a service Receives output from the service Closes a session on SAP BC Displays the output to the user The client code that SAP BC Integrator generates can serve as a good starting point for your own development. 6.6.6.3 Accessing Databases with SAP BC All types of services can access databases – flow services written in webMethods flow language, and services written in Java, C/C++, or Visual Basic: You can create flow services using the Administrator User Interface. When you create a flow service, you make selections from screens in the Server Administrator to describe the function that you want the service to perform. The server generates the flow service for you. You can create Java, C/C++, and Visual Basic services using SAP BC Integrator or your own development environment. SAP BC provides built-in services that perform basic database operations, such as connecting to a database, selecting rows, inserting rows, and deleting rows. Your services can access these built-in services to perform database operations, or they use other database APIs (JDBC, for example) to access databases. Author: Kevin Wilson Page 21 /23 CHAPTER 7 RFC LIBRARY 7.1 OVERVIEW The RFC Library offers an interface to a SAP System. The RFC Library is the most commonly used and installed component of existing SAP Software. This interface provides the opportunity to call any RFC function in a SAP System from an external application. Moreover, the RFC Library offers the possibility to write a RFC Server Program, which is accessible from any SAP System or external application. Most SAP Connectors use the RFC Library as communication platform to SAP Systems. SAP provides the RFC API in the form of C-routines, incorporated in the RFC Library. The RFC Library is available on all SAP Supported Platforms. The RFC Library is forward and backward compatible, i. e. an older release of the RFC Library can communicate with a SAP System at a higher version and vice versa. The most important design features of the RFC Library are: Working with the native RFC Protocol. Maximum functionality, i. e. almost all features of RFC in SAP Systems should be supported by the RFC Library, too. Maximum performance. Maximum flexibility. Full compatibility to other RFC Releases. The RFC Library exists in a Unicode and non-Unicode version. Thus, the Unicode RFC Library is forward and backward compatible, i. e. a current Unicode RFC Application can communicate with any non-Unicode RFC Application independently of its release and vice versa. As expected by modern software, the RFC Library is thread safe. This enables the user to write powerful multithreaded RFC Applications. Information about where to find the current version of the RFC Library is described in OSS note 413708. Author: Kevin Wilson Page 22 /23 APPENDIX A. GLOSSARY TERM DESCRIPTION Business Application Programming Interface (BAPI) Business functions in SAP components that are written in the programming language ABAP. BAPIs are formalized RFCs. Systems that are remote to the SAP component commonly use BAPIs to invoke an action on the SAP component. RFC Server (Listener) A process that can accept RFCs from SAP components. This allows SAP components to access functions in external systems. In SAP BC terminology, the process is called a Listener. Listeners are one or more threads on SAP Business Connector that wait for incoming requests from SAP components. Listeners are named and register with an SAP gateway to indicate that they are ready to accept requests. Listeners can accept RFC or tRFC requests. RFC Client SAP terminology for a process that sends RFCs to an SAP component to invoke functions. Transactional RFC (tRFC) Protocol for ensuring that an RFC is executed successfully and executed only once on the target system. SAP Business Connector can handle both inbound and outbound tRFCs. tRFC protocol Communications method that an SAP component uses to asynchronously invoke a function on a remote system and that a remote system uses to asynchronously invoke a function on an SAP component. The tRFC protocol ensures that an RFC is executed successfully and only once. Remote Function Call (RFC) RFCs are requests that an SAP component sends to invoke functions on remote systems, or calls that remote systems initiate to invoke functions on an SAP component. RFC protocol Communications method that an SAP component uses to synchronously invoke a function on a remote system and that a remote system uses to synchronously invoke a function on the SAP component. SAP BC Service SAP Business Connector functions that are named with a hierarchical interface and service syntax. Services can be flow services (interfaces to data sources, XML documents, or HTML Web sites) or services written in Java or C/C++ by you, third-party vendors, or SAP AG. LIBRFC Code library provided by SAP that allows third parties to integrate the RFC protocol into applications. SAP Business Connector uses LIBRFC to communicate with the SAP components. Intermediate Document (IDoc) EDI-like SAP business document. Partner Manager A process that accepts messages and routes them to a configured location. For example, the Partner Manager can route messages to an SAP system, to SAP BC, or to a remote URL in an XML format. Typically, IDocs are routed through the Partner Manager. Transaction and Message Store A JDBC-compliant database that SAP Business Connector uses to track all transactions that pass through the Partner Manager. Author: Kevin Wilson Page 23 /23