‎2007 Apr 19 8:49 AM
Hi Friends,
In the code ....
I am calling Remote Function module ZRFC_PO_VEND_VALID using java connector and passing PO_Number and Vendor Number as input parameters and after execution it returns (E_POVALID =1 [PO_NUMBER exists for Vendor number] otherwise E_POVALID = 0 )
when i am executing the below code ....in both cases it is returning Zero value.
I tested the function module in se37 its working....
may i know the reason for this....
import com.sap.mw.jco.*;
/**
@author Thomas G. Schuessler, ARAsoft GmbH
*/
public class TutorialBapi1 extends Object {
JCO.Client mConnection;
JCO.Repository mRepository;
public TutorialBapi1() {
try {
// Change the logon information to your own system/user
mConnection =
JCO.createClient("100", // SAP client
"abap", // userid
"abap", // password
"en", // language
"sapdev1", // application server host name
"00"); // system number
mConnection.connect();
mRepository = new JCO.Repository("ARAsoft", mConnection);
}
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
JCO.Function function = null;
JCO.Table codes = null;
try {
function = this.createFunction("ZRFC_PO_VEND_VALID");
if (function == null) {
System.out.println("ZRFC_PO_VEND_VALID" +
" not found in SAP.");
System.exit(1);
}
//mConnection.execute(function);
//*************
JCO.Field vendID = function.getImportParameterList().getField("I_EBELN");
JCO.Field poID = function.getImportParameterList().getField("I_LIFNR");
vendID.setValue("20081");
poID.setValue("4500000017");
try {
mConnection.execute(function);
}
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
JCO.Field povalid =
function.getExportParameterList().getField("E_POVALID");
//if (povalid.getValue() == null ){
// System.out.println("Error Message");
//}
//**************
System.out.println(povalid.getValue());
//if (povalid == null ){
//System.out.println(povalid.getValue("E_POVALID"));
//System.out.println("Error Message");
//System.exit(1);
//}
}
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
mConnection.disconnect();
}
public JCO.Function createFunction(String name) throws Exception {
try {
IFunctionTemplate ft =
mRepository.getFunctionTemplate(name.toUpperCase());
if (ft == null)
return null;
return ft.getFunction();
}
catch (Exception ex) {
throw new Exception("Problem retrieving JCO.Function object.");
}
}
public static void main (String args[]) {
TutorialBapi1 app = new TutorialBapi1();
}
}
with warm regards,
Madhu.
‎2007 Apr 19 8:56 AM
Try padding the vendor number with leading zeroes(Total length 10).
<b>vendID.setValue("0000020081");</b>
Regards,
Ravi
‎2007 Apr 19 9:56 AM
Hi Ravi ,
I tried as per your sugggestion..still getting the same problem.
Regards,
Madhu!!