The following section describes how a function is executed by calling a function module.
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.
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.
All parameters of a JCO.Function object can be called using the methods getImportParameterList(), getExportParameterList(), and getTableParameterList().
The method getStructure() facilitates access to any structure parameter in an import or export parameter list.
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); } |