Skip to Content
avatar image
Former Member

Do I have to use the JCO.IRepository to execute RFC functions?

Hello,

I wonder if I have to create and use a IRepository for my pooled connections or if I just can use IClient.execute(java.lang.String name, JCO.ParameterList input, JCO.ParameterList output, JCO.ParameterList tables) with input/output created by JCO.createParameterList().

Is the meta-information that the repository holds for each function really needed to operate? I am in a memory restricted environment and if I would not need the IRepository I would like to skip it.

Thanks for any information,

Phil

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Mar 08, 2008 at 12:14 AM

    this will be the sample code

    CO.addClientPool(SID, //alias for this pool

    10, //max. number of connections

    "800", //SAP client

    "userid", //userid

    "password", //password

    "EN", //language

    "host", //host name

    "01" //system number

    );

    // Create a new repository

    repository = JCO.createRepository("MYRepository", SID);

    } catch(JCO.Exception ex) {

    System.out.println("Caught an exception: \n" + ex);

    }//try

    }

    public void salesOrders() {

    JCO.Client client = null;

    try{

    // Get a function template from the repository

    System.out.println("start");

    JCO.Function function = repository.getFunctionTemplate(

    "BAPI_SALESORDER_GETLIST").getFunction();

    // Fill in input parameters

    JCO.ParameterList input = function.getImportParameterList();

    input.setValue("0000001200", "CUSTOMER_NUMBER" );

    input.setValue("1000", "SALES_ORGANIZATION");

    input.setValue("0", "TRANSACTION_GROUP" );

    // Get a client from the pool

    client = JCO.getClient(SID);

    // Execute function the remote system

    client.execute(function);

    // Print return message

    JCO.Structure ret=function.getExportParameterList().getStructure("RETURN");

    System.out.println("RETURN MESSAGE: " + ret.getString("MESSAGE"));

    // Get a reference to the table which contains the orders

    JCO.Table orders=function.getTableParameterList().getTable("SALES_ORDERS");

    // Print results

    if(orders.getNumRows() > 0) {

    // Loop over all rows

    do{

    // Loop over all columns in the current row

    for(JCO.FieldIterator e = orders.fields(); e.hasMoreElements();) {

    JCO.Field field = e.nextField();

    System.out.println(field.getName() + ":\t" + field.getString());

    }//for

    } while(orders.nextRow());

    } else{

    System.out.println("No results found");

    }//if

    } catch(Exception ex) {

    System.out.println("Caught an exception: " + ex);

    } finally{

    // Always release client !!!

    JCO.releaseClient(client);

    }//try

    Add comment
    10|10000 characters needed characters exceeded