Automation Component Description

Team-Fly

SAP Automation can be broken down into two broad categories: GUIs and RFCs. The GUIs require only a small amount of knowledge of the business logic within R/3 and require no logic of ABAP (Advanced Business Application Programming), because the GUI method just simulates actual SAP screens which already have the business logic built in. The RFC interface can be implemented in many different ways, including directly, through BAPIs, and through IDocs.

GUIs

In a standard SAP environment, the Application Server communicates with a program called the SAP GUI on the user's workstation. The SAP GUI has a link with each session that the user has open on his or her PC or workstation (the program name is usually FRONT.EXE). When using the GUI tool, you are really intercepting the communication between the SAP GUI software and the Application Server, which allows you to handle two major functions.

The Fine Print

The set of GUI tools works with release 2.1 and later of the R/3 Application Servers. Starting with 3.1H, the SAP Automation GUI software also works with R/2 systems via the CUA gateway. The SAP Automation GUI software provided with R/3 4.5A is for Win32 platforms only (32-bit Windows 95 and Windows NT 4.0 and later). On Windows NT 4.0 systems, Service Pack 3 is strongly recommended.

The first set of functions allows you to replace the screen the user sees with something that may be better suited for the user environment, or to send output to a scrolling display instead of a computer screen.

The second set of functions allows you to record user events or data that SAP is sending to the user. For example, you could fire off an application on the user's PC in response to a certain command code. Or, you could display a picture of a product when the material master transaction is brought up for that product.

Figure 2.1 shows the SAP Automation GUI main screen.

The GUI toolbox can be broken down into three areas: the low-level GUI calls, the GUI Component, and the GUI Code generator. Each level has different capabilities, complexities, and restrictions.

click to expand

Figure 2.1: An example of the SAP Automation GUI main screen. From this screen you can view all the data that is contained on the GUI.

GUI Library

The GUI library is a series of relatively low-level calls that you can access from a C program (sorry, no Java here!). These calls allow you to both read and write to the data stream between the Application Server and SAP GUI software. This type of GUI interface gives you by far the most functionality of any interface, as you have access to all the features that are on a regular SAP screen. These features allow you to log on to an R/3 system, call up a transaction, query the results returned from SAP, and then send data back or execute any function available from the normal SAP GUI screen. The heart of the GUI library tool is the GUILIB.DLL, which contains the API functions. SAP uses the same DLL file for the development of its own GUI and associated recorder.

GUI Component

The GUI Component is a layered application that communicates with the SAP Automation library and any COM-compliant (Component Object Model) software through OLE (Object Linking and Embedding). The GUI Component allows nearly all the same functions as the GUI library but with greater error checking, and it is available as an out-of-process EXE server or as an OLE control. The GUI Component can also be used with any COM-compliant application, such as Office 97 or Lotus Notes.

GUI Code Generator

The GUI Code generator provides yet another layer of software and sits on top of the SAP Component. The purpose of the Code generator is to help the user write code in Visual Basic, HAHTtalk Basic, or Delphi's Object Pascal language. This tool enables you to step through a series of actions in SAP; then, the generator builds up the code in the desired language for you to use as is or incorporate into a larger application.

Remote Function Calls

RFCs, in terms of the SAP world, are simply pieces of code-named function modules that can be called on one system from another system. The two systems can be two different SAP systems or an SAP system and a non-SAP system.

Compared with using the GUI interface methods discussed in the preceding section, using RFCs requires a bit more knowledge of the technical SAP architecture and business logic. Using RFCs, however, gives you a wide range of flexible programming alternatives, including working from non-Windows systems.

Closely related to RFCs are BAPIs. A BAPI is a business object; it could be a purchase order, an employee, or a customer. The reason for the close relationship between RFCs and BAPIs is that currently BAPIs in SAP are implemented through RFCs. Though this situation will probably continue for some time, there is no guarantee that SAP will stick with this practice over the long haul. You should, therefore, clearly understand the difference between an RFC and a BAPI. An RFC is simply a piece of code, whereas a BAPI is an interface to a business object. Thus, when you want to create a business object such as a purchase order, you are really calling a remote function module. You do not need to know ABAP or the name of the function module when using BAPIs. All you do (through the Java BAPI class) is call for a new instance of the purchase order, for example.

The tools from the SAP Automation suite that use RFCs can be broken out into 10 areas. These areas provide varying degrees of support; some can be executed in any environment, but others work only under Windows. Also, like the GUIs, some RFC tools support Java and some do not. In Chapter 16, 'Deciding Which Technology to Use for a New Application,' we compare the various tools and build up a logic flow so that you can decide what to use for your particular application programming needs.

Logon Control

The Logon control is implemented through an ActiveX control and allows any COM-compliant application to log on to an SAP system. The Logon control allows you to hide the SAP logon window if you want to determine the system or log on via a program. Though this control can be used through Java, a connection interface provided with the Java class is easier and quicker. The Java class is discussed later in this section.

You can use the Logon control to build a button on your application that allows the user to log on to SAP. The Logon control was specifically designed for Visual Basic (VB) and C++.

RFC API

The RFC API routines allow access to an SAP system through RFCs. This process includes two-way communication so that a C program can call an ABAP RFC and an ABAP program can call a C program. The required files and documentation can be found in the RFC Software Development Kit (RFC SDK) and are part of the standard SAP Automation installation under the . . ./rfcsdk/include/ directory. In addition, examples and help documentation are under the . . ./rfcsdk/text/ directory. From within SAP you have the ability to create C program stubs, as shown in Figure 2.2. A stub is a shell of a C program with the calling parameters already set up.

click to expand

Figure 2.2: An example of the creation of a stub in SAP

RFC Component

The RFC component is an ActiveX component that exposes RFC functionality to COM-compliant applications. By automatically performing some of the preparation work that is usually required when using RFCs directly with C, the RFC Component makes using RFCs easier from within programs written in languages like Visual Basic. For example, when using RFCs directly, you need to declare and configure the desired RFC functions and their parameters. The RFC component eliminates the need to do so in the COM-compliant programs using it. The RFC component comprises two objects: Function components and Table components.

Transaction Component

The Transaction component is an OCX control that can be used either through the online Assistant or through a COM-compliant application program. Online users use the control when they select the Transactions tab. Application programs use the Transaction control to create Transaction objects. This process is very similar to generating BDC (Batch Data Communications) sessions in SAP. The data flow is only one-way, though-into SAP; the status of the current transaction is not communicated back to the calling program. The Transaction component can be executed only in a Windows operating environment.

RFC Java Class Library

The Java Class library provides Java programmers with an object-oriented view of RFCs within SAP and allows Java programs to use all the functionality of the RFCs. As you may already have guessed, RFC functionality is the primary focus of this book, because most of the application programs and applets use RFCs to get into an SAP System.

The Java Class library acts like a buffer between your Java program and the low-level C calls that are required to connect to the SAP system. The Java Class library has two components: the Java client and the Java server. Installation of these components, along with more technical information, is provided in Chapter 4, 'Setting up the Development and Operating Environments.'

Through the Java Class library, you have access to the SAP RFCs via the classes com.sap.rfc (see Chapters 19, 'The COM.SAP.RFC Package,' and 20, 'The COM.SAP.RFC.EXCEPTION Package') and com.sap.bapi (see Appendix C, 'ABAP/4 Data Types to Java Cross-Reference').

RFC C++ Class Library

The C++ Class library works in a similar fashion as the Java Class library, but for the C++ language.

IDoc C++ Class Library

IDocs, or Intermediate Documents, are structured data packets that are sent back and forth between two systems via RFCs.

The IDoc Class Library allows you to write C++ code that:

  • Makes transactional RFC calls to send IDocs inbound to R/3.

  • Acts as a transactional RFC server to receive outbound IDocs from R/3.

  • Creates IDocs segment by segment.

  • Navigates through the IDoc tree structure to access IDoc segments by name.

  • Reads data from and writes data to fields in segments. Fields are accessed by name; data type conversions are done automatically.

As the name of the section suggests, this library can be used only to generate C++ programs.

Repository Services

The Repository Services tool retrieves information from SAP about business objects and RFCs, such as calling parameters and exceptions. This information can then be stored at the local server, which can be viewed offline or used to speed up access to the R/3 system for programs running online. The database that is used for local storage adheres to Microsoft Access format and allows the storage of several SAP systems on the same database (though you can only access one at a time). The Repository Services tool works with any COM-compliant application but runs only on Windows.

See Chapter 14, 'SAP Assistant,' for more details on the Repository Services tool.

Repository Browser

The Repository Browser opens up RFC and BAPI to the outside world. Through the Repository Browser tool you can view, search, and execute RFCs either online or through a COM-compliant application. The Repository Browser is implemented through an ActiveX control. The online functionality is achieved through the SAP Assistant, which is discussed in the next section.

SAP Assistant

The SAP Assistant is a multifunction tool that allows you to search, view, and call RFCs. Through the SAP Assistant, you can generate both C++ and Java classes based on existing SAP BAPI functions. The SAP Assistant is covered in detail in Chapter 14. The SAP Assistant screen is shown in Figure 2.3.

click to expand

Figure 2.3: An example of the SAP Assistant screen


Team-Fly


Java & BAPI Technology for SAP
Java & BAPI Technology for SAP
ISBN: 761523057
EAN: N/A
Year: 1998
Pages: 199

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net