Please provide me a sample source code for execution of "BAPI_BUPA_SEARCH" or "BAPI_BUPA_SEARCH_2" BAPI.
Basic problem I am getting is at
JCO.Structure addrDataStr=input.getStructure("ADDRESSDATA")
I am not able to set the proper value in JCO.Structure. Please help me.
Following is the code I am trying to execute
JCO.Client mConnection = null;
IRepository mRepository;
public JCO.Function createFunction(String name) {
try {
return mRepository.getFunctionTemplate(name.toUpperCase()).getFunction();
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
private void getBussinessPartner(){
try {
mConnection = JCO.createClient("800","userID","******","EN","SAPCRMSystem_IP","00");
// Open the connection
mConnection.connect();
mRepository = new JCO.Repository("SharedRepository", mConnection);
JCO.Function function = this.createFunction("BAPI_BUPA_SEARCH_2");
// Fill in input parameters
JCO.ParameterList input = function.getImportParameterList();
JCO.Structure addrDataStr=input.getStructure("ADDRESSDATA"); //SEARCHRESULT
addrDataStr.setValue("Germany","COUNTRY");
//addrDataStr.setValue("Frankfurt", "CITY1");
mConnection.execute(function);
if(function.getExportParameterList()!=null){//It is always null
JCO.Structure returnStructure = function.getExportParameterList().getStructure(0);
for (int i = 0; i < returnStructure.getFieldCount(); i++) {
System.out.println( returnStructure.getField(i).getName()+" : " + returnStructure.getString(i));
}
}
}catch (Exception ex) {
ex.printStackTrace();
System.out.println("Caught an exception: \n" + ex);
}
finally {
// do not forget to close the mConnection connection
if (mConnection != null) mConnection.disconnect();
}
}