on 08-16-2015 11:06 AM
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")); | |||
} |
Hi Utsav,
isn't the error message clear? :
Field PO_ITM is not a member of BAPIITEMIN
I just had a look into some SAP system containing the appropriate structures and indeed I do not see such a field name. Here available field names for table structure BAPIITEMIN are ITM_NUMBER or PO_ITM_NO. Please check your RFM interface for BAPI_SALESORDER_CREATEFROMDAT1 at back-end side (SE37) and correct your code accordingly.
Furthermore calling orderItemsTable.setRow(1) is unnecessary and incorrect. Please see the contained JCo JavaDoc at methods
JCoTable.appendRow()
JCoTable.setRow(int pos)
Best regards,
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
JCoFunction.toXML() returns the whole function data as a (proprietary) XML string. This is also includes all results if called after execution.
If you prefer to work with separate objects for the RFC request and the RFC response you may also use the JCoRequest / JCoResponse model instead of using a JCoFunction. There is no advantage if using this model, it's just a personal preference and style.
Hi Utsav,
Pleaes check field PO_ITM in your table ORDER_ITEMS_IN. I don't see any issue in your java code. Please first try to run your BAPI independently or if still it doesn't work then please put debugger on.
Thanks,
Hamendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
clear the cache of the server in NWA
Regards
Vijay Kalluri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.