SAP RFC
Calling an SAP RFC
A Remote Function Call is the call of a function module that runs in a different system than the calling program (although it would be possible to call it from the same system). The connection is established via the network protocol TCP/IP. Lobster_data uses the SAP RFC Java Class Library to implement RFC calls.
In the SAP system, the RFC interface system provides this functionality. The RFC interface system enables function calls between two SAP systems (R/2 or R/3) or between an SAP system and a non-SAP system.
An RFC is defined by an interface that can contain three different types of data.
Fields of a certain type (e.g. text, number, date, ...) and of a certain length.
Structures represent a list of fields.
Tables contain several values of different fields.
An interface description can roughly be divided into three parts.
Input parameters that are passed by the caller. These can be fields or structures.
Output parameters that are returned to the calling system after the execution of the function module. These can be fields or structures.
Tables for both input and output tables.
The following example will explain how an RFC works. Using the RFC RFC_READ_TABLE, two fields are to be read from an SAP system from table T005K. The following screenshot shows the structure of this table.
The following screenshot shows the RFC interface description of the RFC with name RFC_READ_TABLE.
The RFC has the five input parameters
DELIMITER,
NO DATA,
QUERY_TABLE,
ROWCOUNT and
ROWSKIPS.
In addition, the RFC has the following table parameters.
DATA. This table stores the data of the table.
FIELDS. In this table, the fields to be delivered are selected and the structure of these fields is defined.
OPTIONS. This table contains optional WHERE conditions for the query.
The function module has no output parameter that can be displayed in the form of a field or a structure.
Lobster_data is able to send RFC calls to an SAP system and process the response of the SAP system. This mechanism is used in Lobster_data on the input side to fetch data from an SAP system. The data supplied by the SAP system can then be processed in the CSV or Fixed-length format by the calling profile. For details refer to section SAP (Input Agent Cron).
If an SAP RFC is called in a Response Route of a Lobster_data profile, the response of the SAP system can be transferred to a subsequent profile via Message for further processing. For details refer to section Response Route SAP.
Lobster_data can query the interface definition of an RFC in an SAP system and import the structure.
Attention: Lobster_data RFC calls contain only the sending of the import parameters and the table parameters to the function module, as well as the return of the export parameters and the table parameters from the function module to Lobster_data. If the function module tries to access SAP GUI functionality, such as copying files between SAP and the desktop computer, this function module call will fail when called from Lobster_data.
Debugging an SAP RFC
Lobster_data offers the option of recording SAP RFC calls executed by it both on the input and the output side for debugging purposes.
The recording is activated by setting the checkbox Trace messages for phase 1 and 6 in the logging settings. For phase 6, the checkbox SAP must also be set. See sections System Logging and Profile Logging.
On the input side (phase 1), SAP RFC calls are recorded in two files, which are stored in directory ./debug/sap. The files have the names __debugIRfcIn.xml and __debugIRfcOut.xml.
On the output side (phase 6), SAP RFC calls are recorded in HTML format in the Lobster_data message log.
Note: Debugging only affects communication with the SAP system. It is not possible to debug the ABAP component of the RFC in Lobster_data.
RFC Call in Phase 3 and 5
See function call-sap-rfc(alias a,rfc b,[inMap c,timeout d,filter e,outList f,debug g,h,i,j,k]) and Integration Unit RFCUnit.