on 04-11-2005 9:17 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.