Not original content: From Developing Applications with the SAP Java Connector (JCO Tutorial.pdf) by Thomas G Schuessler at : http://www.arasoft.de/
BAPIs and Other RFMs
ABAP Function Modules can only be called from an external client if they are marked as RFC-enabled. R/3 contains several thousands of such RFC-enabled Function Modules (RFMs). Amongst them are the BAPIs. BAPIs are RFMs that follow additional rules and are defined as object type methods in SAP’s Business Object Repository (BOR). Use transaction codes BAPI and SE37 to investigate the metadata of the BAPIs and other RFMs in SAP. If you do not have access to an SAP system, or you want to look up interfaces in a different release, use the SAP Interface Repository (http://ifr.sap.com).
BAPI details
Does the BAPI pop up SAPGUI dialogs? These BAPIs were built mainly for the communication between SAP components, they rarely make any sense in a Java application. SAPGUIs are difficult to pop up from a web application running in a browser…
If you want to use BAPIs in a more object-oriented way, you need to utilize proxy classes. These proxies have the following advantages:
- A business object type in the BOR is represented by one Java class, the BAPIs are methods of the class.
- Instead of the somewhat ugly function and parameter names in the SAP Function
- Builder you use the nice names in the BOR.
- You can exploit additional BOR metadata. One example is that the BOR knows
- which table parameters are import, which are export, and which are import and export. The Function Builder has no notion of this.
An RFM can be released for customer use or not.3 Most BAPIs are released RFMs, only very new ones may be unreleased at first so that SAP and the customers can test them for a while before they are released in a subsequent release. On the other hand, there are quite a few extremely useful RFMs that are not officially released for customer use. Many of these RFMs are not documented (or only in German), which makes it harder to figure out exactly how they work. Additionally, SAP has reserved the right to make incompatible changes to unreleased RFMs. Using these directly in your applications could thus result in a huge maintenance effort. Hence all access to unreleased RFMs must be done through components in order to limit maintenance to this one component as opposed to potentially many individual applications.
BAPI Screen Shot
RFC-enabled Function Modules
RFMs can have three types of parameters, import (the client sends these to the RFM), export (RFM sends these back to the client), and tables (bi-directional). Import and export parameters can be simple fields (a.k.a. scalars) or structures.4 A structure is an ordered set of fields.
Using the Function Builder SE37
Even the very technical test environment of the Function Builder uses the conversion exits. But the BAPI itself does not invoke them. Many developers in this situation end up hard-coding the German equivalent of OR (TA) in their programs. That may be acceptable for a quick-and-dirty demo program, but software for production use should avoid hard-coding constants that are subject to SAP customization. Also, conversions are required for many other parameters, and it would definitely be better to have a generic solution.
 Screen shots of SE37
Java Connector (JCO)
- Allows you to build both client and server applications. Its ability to use connection pooling makes it an ideal choice for web server applications. (There are two ways of connecting – with direct connections and with connection pooling) Pools are critical for the performance of web server applications. They have two benefits:
- You avoid the overhead of logging on to SAP, because once the logon has happened , the connection stays open and can be reused.
- You limit the maximum number of connections used concurrently, thus preventing the use of too many SAP resources. Be careful, though, not to create a performance bottleneck in your own application, by making the maximum number of connections too small and thus creating wait situations for your users. Your SAP system must be configured so that it can accommodate the extra load created by your application.
It can be downloaded from http://service.sap.com/connectors
Powered by ScribeFire.