To establish a connection to the SAP System, you need to instantiate a JCO.Client object using the JCO.createClient() method. You can then use the object�s connect() and disconnect() methods. Between these two methods, you will later add code for calling the function module, and setting and getting the parameter values.
The user name must have SAP permissions in the backend system to run the BAPI.
If you get this far I'll try an explain the process of JCO repository and templatefunction interface required to specify the in/out parameters of the function.