Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using BAPI ( BAPISDORDER_GETDETAILEDLIST)

Former Member
0 Likes
1,563

dear all my frinds

i have abroblem with BAPI ( BAPISDORDER_GETDETAILEDLIST) when i access it from the java source code using

JCO connector. evry time i pass a value of a sales order number in the table (SALES_DOCUMENTS) and also the parameters in

structure (I_BAPI_VIEW) and excute the function.i found all the tables that i will get the data from its size is zero.

and some times not run and take alot of time.

and i try another function it work correctly in the same project.

and this is my code

public String viewsalesorder_action() {

// TODO: Process the action. Return value is a navigation

// case name where null will return to the same page.

try{

JCoFunction functionsaleso = getApplicationBean1().getConnect().getFunction("BAPISDORDER_GETDETAILEDLIST");

}catch(Exception ex ){

JOptionPane.showMessageDialog(null, "error in function call");

}

JOptionPane.showMessageDialog(null, "ok");

JOptionPane.showMessageDialog(null, "get function");

JCoStructure ssale = functionsales.getImportParameterList().getStructure("I_BAPI_VIEW");

ssale.setValue("HEADER","X");

ssale.setValue("ITEM","X");

ssale.setValue("PARTNER","X");

ssale.setValue("SDCOND","X");

JOptionPane.showMessageDialog(null, "append data to structure");

JCoTable table_sales = functionsales.getTableParameterList().getTable("SALES_DOCUMENTS");

table_sales.appendRow();

table_sales.setValue("VBELN", "1258");

// textField1.getText().toString().trim()

// Excute the functon

JOptionPane.showMessageDialog(null,"number of rows in table sales documents"+table_sales.getNumRows() );

getApplicationBean1().getConnect().execute(functionsales);

JOptionPane.showMessageDialog(null, "function excuted");

// return the output of the function.

JCoTable tableheder = functionsales.getTableParameterList().getTable("ORDER_HEADERS_OUT");

TableAdapterReader adapterheder = new TableAdapterReader(tableheder);

JOptionPane.showMessageDialog(null, "adabter set size = " + adapterheder.size());

for (int i = 0; i < adapterheder.size(); i++) {

textField2.setText(adapterheder.get("DOC_DATE"));

textField3.setText(adapterheder.get("REC_DATE"));

textField4.setText(adapterheder.get("DLV_BLOCK"));

textField6.setText(adapterheder.get("NET_VAL_HD"));

textField7.setText(adapterheder.get("CURRENCY"));

adapterheder.next();

}

JCoTable tablepartener = functionsales.getTableParameterList().getTable("ORDER_PARTNERS_OUT");

TableAdapterReader adapterpartener = new TableAdapterReader(tablepartener);

JOptionPane.showMessageDialog(null, "adabter set size = " + adapterpartener.size());

// adapterpartener.next();

// textField5.setText(adapterpartener.get("CUSTOMER"));

JCoTable tablecond = functionsales.getTableParameterList().getTable("ORDER_PARTNERS_OUT");

TableAdapterReader adaptercond = new TableAdapterReader(tablecond);

JOptionPane.showMessageDialog(null, "adabter set size = " + adaptercond.size());

return null;

}

2 REPLIES 2
Read only

Former Member
0 Likes
912

Try to pass the order number with preceeding ZEROS (Total 10 characters) while filling order number using table_sales.setValue.

table_sales.setValue("VBELN", "0000001258");

Read only

0 Likes
912

Thank you mr.Vinod Kumar

i try that and it's working good.

thank you