Show TOC

Procedure documentationExecuting Functions Locate this document in the navigation structure

Procedure

The following section describes how a function is executed by calling a function module.

Example Example

Example: You want to call the BAPI CompanyCode.GetList. The corresponding RFM is called BAPI_COMPANYCODE_GETLIST. This RFM does not contain any import parameters.

  1. Create a JCO.Function object and call the method execute() of the JCO.Client object by entering the JCO.Function object as a parameter. The BAPI has two export parameters.

  2. All parameters of a JCO.Function object can be called using the methods getImportParameterList(), getExportParameterList(), and getTableParameterList().

  3. The method getStructure() facilitates access to any structure parameter in an import or export parameter list.

End of the example.

Executing Functions

JCO.Function function = null;

function = this.createFunction ("BAPI_COMPANYCODE_GETLIST");

mConnection.execute(function);

JCO.Structure returnStructure =

function.getExportParameterList ().getStructure ("RETURN");

if (! (returnStructure.getString("TYPE").equals("") ||

returnStructure.getString("TYPE").equals("S")) ) {

System.out.println(returnStructure.getString ("MESSAGE"));

System.exit (1);

}