cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass an arrey to an RFC Import paramater?

Former Member
0 Kudos

Hello,

Is there any example or tutorial out there which demonstrate how to pass an array of data to an import parameter of an RFC or an RFC table Structure using JAVA? PLEASE HELP OUT. You could send it to rudy-e@gmx.net

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Rudolph,

Please read my weblogs.

/people/perumal.kanthan/blog/2005/03/09/handling-structuretable-transactions-using-bapis-in-web-dynpro-part-i

/people/perumal.kanthan/blog/2005/03/09/handling-structuretable-transactions-using-bapis-in-web-dynpro-part-i

Former Member
0 Kudos

Kanthan, your code is regardin ABAP, Web dynpro and so on. I and Rudolph have the same problem.

Gregor, thanks by your code, it solves my problem regardin passing tables as parameteres.

gregorw
Active Contributor
0 Kudos

Hello Rudolph,

I've used this code to simulate a salesorder:


            // Get a function template from the repository
            IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_SALESORDER_SIMULATE");
            
            // Create a function from the template
            JCO.Function function = new JCO.Function(ftemplate);
            
            // Get a client from the pool
            JCO.Client client = JCO.getClient(POOL_NAME);
            
            // Fill in input parameters
            JCO.Structure orderHeader = function.getImportParameterList().getStructure("ORDER_HEADER_IN");

            orderHeader.setValue(       "TA", "DOC_TYPE"  );
            orderHeader.setValue(      "0001", "SALES_ORG" );
            orderHeader.setValue(        "10", "DISTR_CHAN");
            orderHeader.setValue(        "10", "DIVISION"  );

            JCO.Table orderPartners = function.getTableParameterList().getTable("ORDER_PARTNERS");

            orderPartners.appendRow();
            // orderPartners.setValue("0001043543", "PARTN_NUMB" );
            orderPartners.setValue("00010453454", "PARTN_NUMB" );
            orderPartners.setValue(        "AG", "PARTN_ROLE" );
            
            JCO.Table orderItems = function.getTableParameterList().getTable("ORDER_ITEMS_IN");

            orderItems.appendRow();
            orderItems.setValue("A", "MATERIAL" );
            orderItems.setValue(      "1000", "REQ_QTY" );
            orderItems.appendRow();
            orderItems.setValue("B", "MATERIAL" );
            orderItems.setValue(    "20000", "REQ_QTY" );
            orderItems.appendRow();
            orderItems.setValue("C", "MATERIAL" );
            orderItems.setValue(    "5000", "REQ_QTY" );
            orderItems.appendRow();
            orderItems.setValue("D", "MATERIAL" );
            orderItems.setValue(    "10000", "REQ_QTY" );
            orderItems.appendRow();
            orderItems.setValue("E", "MATERIAL" );
            orderItems.setValue(    "100000", "REQ_QTY" );
						
            // Call the remote system
            client.execute(function);
            
            // Print return message
            JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
            System.out.println("BAPI_SALESORDER_SIMULATE RETURN: " + ret.getString("MESSAGE"));
            
            // Get table containing the orders
            JCO.Table sales_orders = function.getTableParameterList().getTable("ORDER_ITEMS_OUT");
            
            // Print results
            if (sales_orders.getNumRows() > 0) {
                
                // Loop over all rows
                do {
                    
                    System.out.println("-----------------------------------------");
                    
                    // Loop over all columns in the current row
                    for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements(); ) {
                        JCO.Field field = e.nextField();
                        System.out.println(field.getName() + ":t" + field.getString());
                    }//for
                } while(sales_orders.nextRow());
                
            }
            else {
                System.out.println("No results found");
            }//if
            
            // Release the client into the pool
            JCO.releaseClient(client);

Regards

Gregor