Official Content

To invoke a BAPI through RFC (Remote Function Call), first import it into the GeneXus KB from GeneXus ERP Connector.

Next, select the BAPI(s) you want to import and press the Import button.

This will generate an External Object in the KB with the BAPI’s name and all its methods.


Then, from any GeneXus object, you may invoke with <EO>.<method>(parms) or <EODataTypeVariable>.<method>(parms)


Upon generating this object, GeneXus will create an RFC call to invoke the BAPI. At runtime, the RFC call uses SAP Connector (SAP .Net Connector or SAP Java Connector depending on the GeneXus generator used), so it is a prerequisite to have it installed and distribute the corresponding DLL with the application.

SAP .Net connector and SAP Java connector are free of charge for SAP Customers and SAP Partners.

ERP Connector - Generating the application with GeneXus .NET generator

ERP Connector - Generating the application with GeneXus Java generator

Note: RFC calls to the BAPI are only supported in .NET and Java generators. Android and iOS Devices cannot invoke the BAPI directly; they need to call server-side components (generated in .NET or Java) that interact with the BAPI.

Before invoking a BAPI via RFC from a GeneXus object, the application must be connected to the SAP server where the BAPI will be invoked.

To do so, see:

Using the External Object GXEnterpriseSessionManager


Types of methods

Each BAPI has two types of methods: an instance method, and a class method. You will notice the class method in the GX ERP connector marked with a red circle in its icon.

Instance Method

Class Method

When you use a class method in a GeneXus Object, you use the External Object directly in the code by writing <EOName>.<ClassMethodName>(<parms>).


But when you use an instance method, you must define a variable of the External Object data type. In the GeneXus Object, you must select a value for the SAP Object Key (this means to instantiate the object) and invoke the method from the variable <EODataTypeVariable>.<InstanceMethod>(<parms>).

&Material.Material = '000000000000000001' // Material number instantiation for GetDetail


Using Zfunctions

In addition to standard BAPI, there are other standard or user-developed RFC functions (the latter are known as Zfunctions).

All those functions can be used with GeneXus ERP Connector, but to be seen by GeneXus ERP Connector, they must be published in the BOR (Business Object Repository). This is done in SAP ERP using  these steps (in particular, from Stage 3).



Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant