Skip to Content
0
Former Member
Aug 16, 2015 at 10:06 AM

how to create sales order using JCO3

211 Views

Hi I am working with JCO3.0 and i am unable to create sales order. Please help me to create sales order.

Exception in thread "main" com.sap.conn.jco.JCoRuntimeException: (127) JCO_ERROR_FIELD_NOT_FOUND: Field PO_ITM is not a member of BAPIITEMIN

at com.sap.conn.jco.rt.AbstractMetaData.indexOf(AbstractMetaData.java:404)

at com.sap.conn.jco.rt.AbstractRecord.setValue(AbstractRecord.java:3976)

at org.sample.poc.PO.createSaleOrder(PO.java:65)

at org.sample.poc.PO.main(PO.java:16)

Below is my program:


 
 
public static void createSaleOrder() throws JCoException { JCoDestination destination = JCoDestinationManager.getDestination("ABAP_AS_WITHOUT_POOL"); JCoFunction createSalesOrderFunction = destination.getRepository().getFunction("BAPI_SALESORDER_CREATEFROMDAT1"); if(createSalesOrderFunction==null) { throw new RuntimeException("Cant create sale order it is null"); } try { createSalesOrderFunction.execute(destination); } catch (Exception e) { // TODO: handle exception } System.out.println("Import Parameter List" + createSalesOrderFunction.getImportParameterList()); System.out.println("Export Parameter List" + createSalesOrderFunction.getExportParameterList()); System.out.println("Table Structure" + createSalesOrderFunction.getTableParameterList()); // Fill in Input Parameters JCoParameterList inputParamaterList = createSalesOrderFunction.getImportParameterList(); JCoParameterList tableParameterList = createSalesOrderFunction.getTableParameterList(); // Get the Table JCoTable orderItemsTable = tableParameterList.getTable("ORDER_ITEMS_IN"); System.out.println(orderItemsTable); orderItemsTable.appendRow(); orderItemsTable.setRow(1); orderItemsTable.setValue("ITM_NU","000010"); orderItemsTable.setValue("PO_ITM","89786767757575");// can be changed orderItemsTable.setValue("MATERIAL","3000"); orderItemsTable.setValue("CUST_MAT","7789012345678901234567");// can be changed orderItemsTable.setValue("REQ_QTY","8901234567890");// can be changed Qty * 1000 try { createSalesOrderFunction.execute(destination); } catch (Exception e) { // TODO: handle exception } // Print the Return Message JCoStructure returnStructure = createSalesOrderFunction.getExportParameterList().getStructure("RETURN"); rintln("BAPI_SALES_ORDER_GETLIST RETURN: " + returnStructure.getString("MESSAGE")); }