SAP RFC Interface Call

  • Last update:August 04, 2026
  • Overview

    As an independent system, SAP mainly interacts with external systems in the following two ways:

    • Direct connection to the underlying database

    • Data calls through the dedicated SAP Remote Function Call (RFC) interface

    Therefore, when you design reports that use data from an SAP system in FineReport, you can retrieve data by directly connecting to the database or by using the RFC interface.

    Common relational databases for SAP systems include Oracle and DB2. FineReport can directly connect to the database used by the SAP system through the Java Database Connectivity (JDBC) API to retrieve data. However, this method requires report designers to fully understand the SAP system database, and this database must allow access from other systems. You are advised to use the SAP Dataset plugin to connect to the SAP system with an SAP account and retrieve data.

    iconNote: 
    You are advised to use the SAP Dataset plugin. Use the method described in this document only when data retrieval through the plugin fails and you need to troubleshoot the issue.

    This document uses an example to describe how to write Java files to retrieve data through the dedicated SAP RFC interface.

    Implementation Method

    First, use a Java class file to establish a connection to SAP. Then, use the class dataset interface to convert the data retrieved through RFC into a virtual two-dimensional table. Finally, use the virtual table as the data source for report creation.

    Procedure

    Adding SAP JAR Files

    Linux:

    Download SAP JAR files from SAP Software Download Center.

    JDK Bit VersionSAP JAR File Location

    32-bit

    Place sapjco3.jar in the Tomcat installation directory\lib path.

    Place libsapjco3.so in the Java installation directory\jre\bin path.

    Place libsapjco3.so in the usr\lib path. If Linux is 64-bit, place it in the usr\lib64 path.

    64-bit

    Place sapjco3.jar in the Tomcat installation directory\lib path.

    Place libsapjco3.so in the Java installation directory\jre\bin path.

    Place libsapjco3.so in the usr\lib64 path.

    iconNote:
    If the connection still fails, check the error message. For example, if SAP JCo verification fails because the shared library libstdc++.so is missing, install the required shared library. SAP JCo 2 depends on this shared library, but SAP JCo 3 does not.

    Windows:

    Download SAP JAR files from SAP Software Download Center.

    JDK Bit VersionJDK VersionFileSAP File Location

    32-bit

    JDK 1.8 with an update release of 8u102 or later

    sapjco2_window_32bit

    Place sapjco.jar in the Tomcat installation directory\lib path.

    Place librfc32.dll in the C:\Windows\System32 path.

    Place sapjcorfc.dll in the C:\Windows\System32 path.

    64-bit

    JDK 1.8 with an update release of 8u102 or later.

    sapjco2_window_32bit

    Place sapjco.jar in the Tomcat installation directory\lib path.

    Place librfc32.dll in the C:\Windows\System32 path.

    Place sapjcorfc.dll in the C:\Windows\System32 path.

    Connecting to SAP

    Use the ConnectSAPServer class to establish a connection to SAP systems. Click to download the ConnectSAPServer class file: ConnectSAPServer.java.zip

    iconNote: 

    For details about the connection procedure, see Compiling a Java Program.

    Defining a Class Dataset

    After the database is connected, define a class dataset. Then, use the class dataset interface to convert the data into a virtual table.

    Click to download the ParamSAPDataTest class file: ParamSAPDataTest.java.zip

    If you need to replace the class file, delete the generated ABAP_AS_WITH_POOL.jcoDestination file at the same time.

    Configuring a Class Dataset

    1. Copy the compiled ParamSAPDataTest.class class file to the /webroot/WEB-INF/classes/com/fr/data path of the project.

    iconNote: 
    During remote design, the class file corresponding to the class dataset must be placed in both the local designer project and the remote server project.

    2. Create a template, click the icon above Template Dataset, select Class to open the Class Dataset window, and select the required class file.

    3. After you complete the configuration, a class dataset is successfully created in the designer, as shown in the following figure.

    iconNote: 
    When the class dataset is executed for the first time, the ABAP_AS_WITH_POOL.jcoDestination configuration file is generated in the directory where the FineReport designer startup program is located, usually FineReport installation directory\bin. If you need to replace the class file, delete the ABAP_AS_WITH_POOL.jcoDestination file at the same time.

    Summary

    Using the RFC interface prevents issues caused by direct connections to the SAP system database. RFC parameters and table-calling methods are also well documented online or provided by SAP vendors. However, this method requires class files to retrieve data, which can be cumbersome when many reports are involved. To implement effects such as chart linkage, you need to define parameters in the class, making later modifications inconvenient. Therefore, this method is suitable for technical personnel with Java development experience.

    Attachment List


    Theme: Secondary Development
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy