Start of Content Area

Procedure documentation Executing a Function  Locate the document in its SAP Library structure

Activities

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

 

ExampleExample: 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.

 Syntax documentation

Executing a Function

 

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);

}

 

 

 

 

 

End of Content Area