Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

problem while executing BAPI_PRODORD_GET_DETAIL through JAVA using JCo

Hi All,

I am trying to get Production Order details in JAVA program using JCo. Following is the code I have written.

JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS); 

JCoFunction function = destination.getRepository().getFunction("BAPI_PRODORD_GET_DETAIL"); 
if(function == null) 
throw new RuntimeException("BAPI_PRODORD_GET_DETAIL not found in SAP."); 

function.getImportParameterList().setValue("NUMBER", 1067831); 

JCoStructure struct ="BAPI_PP_ORDER_OBJECTS")); 

struct.setValue("HEADER", 'Y'); 
struct.setValue("POSITIONS", 'Y'); 
struct.setValue("SEQUENCES", 'Y'); 
struct.setValue("OPERATIONS", 'Y'); 
struct.setValue("COMPONENTS", 'Y'); 
struct.setValue("PROD_REL_TOOLS", 'Y'); 
struct.setValue("TRIGGER_POINTS", 'Y'); 

function.getImportParameterList().setValue("ORDER_OBJECTS", struct); 

catch(AbapException e) 
JCoStructure returnStructure = function.getExportParameterList().getStructure("RETURN"); 
if (! (returnStructure.getString("TYPE").equals("") || 
   returnStructure.getString("TYPE").equals("S") || 
   returnStructure.getString("TYPE").equals("W")) ) 


JCoTable codes = function.getTableParameterList().getTable("HEADER"); 
int iCnt = codes.getNumRows(); 
System.out.println("No Of Rows " + iCnt); 
int iFldCnt = codes.getNumColumns(); 
JCoMetaData codesMD = codes.getMetaData(); 
for (int i = 0; i < codes.getNumRows(); i++) 

// Display the data 


The number which I am passing is a valid production order. When I test this BAPI in SAP gui with same input, it gives back the data but when I try to run this through java I always get the return message as this production order does not exist. Is there anything wrong I am doing?

I am using JCo 3.0

I have tried passing various values to ORDER_HEADER structure. I have tried getting the structure from import parameter list and then setting the values on that itself. Nothing has worked for me.



Former Member
Not what you were looking for? View more on this topic or Ask a question