on 11-13-2007 12:08 PM
Hi Expert,
I have one BAPI to store the document in KPRO. BAPI_DOCUMENT_CREATE2
If call that BAPI in java class program it is working fine.
If i call that java class in web Dynpro application it is not working.
Below code to store the file in to KPRO
public static boolean doUpload(String path,String number){
JCO.Client client = null,client1 = null;
JCO.Repository repository = null,repository1 = null;
JCO.ParameterList inputParameter = null, outputParameter = null,inputParameter1 = null;
JCO.Function bapiDocument = null,bapiDocument1 = null;
JCO.Table table_lsdoc=null,table_Doc_Details=null;
JCO.Table table_in_FilePath=null,table_out_Return=null;
JCO.Structure st=null,st1=null;
String file_Path="",return_Message="",doc_Type="",stor_Cat="";
try{
client = ConnectToR3.getConnection();
System.out.println("1");
repository = new JCO.Repository("SearchRepository", client);
System.out.println("2");
//System.out.println("Connected to repositry");
bapiDocument = repository.getFunctionTemplate("Z_DOCUMENT_CREATE").getFunction();
System.out.println("3");
JCO.setMiddlewareProperty("jco.middleware.allow_start_of_programs", "ftp;sapftp;sapftpa;sapkprotp;http;saphttp;saphttpa");
System.out.println("4");
if (bapiDocument != null){
table_in_FilePath=bapiDocument.getTableParameterList().getTable("S_DOCUMENTFILES");
table_in_FilePath.appendRow();
table_in_FilePath.setValue(number, "DOCUMENTNUMBER");
table_in_FilePath.setValue(path, "DOCPATH");
client.execute(bapiDocument);
System.out.println("5");
table_out_Return=bapiDocument.getTableParameterList().getTable("S_DOCUMENTFILES");
System.out.println("6");
int flag=0;
if(table_out_Return.getNumRows()>0){
System.out.println("7");
table_out_Return.firstRow();
for(int i=0;i<table_out_Return.getNumRows();i++){
System.out.println("8");
System.out.println(table_out_Return.getValue("DELETEVALUE").toString());
if(table_out_Return.getValue("DELETEVALUE").toString().equalsIgnoreCase("s")){
flag=1;
break;
}else{
flag=0;
break;
}
//table_out_Return.nextRow();
}
if(flag==1)
return true;
else
return false;
}else
return false;
//return false;
}else
return false;
//return false;
}catch(Exception e){
System.out.println("Exception in Upload "+e);
return false;
}
finally{
try{
if (client != null){
ConnectToR3.closeConnection(client);
}
}
catch (Exception ef){
System.out.println("Exception in Finally Block in SAPConnect."+ ef.getMessage());
return false;
}
}
In above code i created Z RFC for some customization. Actual Bapi to Store the file in KPRO "BAPI_DOCUMENT_CREATE2".
To execute this bapi from webdynpro any exe or dll file required.I saw some other thread 2 exe are required to execute the above RFC(<b>SAPFTP.exe, SAPHTTP.exe</b>).
If it is required to place the above 2 exe, where to place that exe's in webdynpro application.
Please help me.. Urgent....
Regards,
Satya 😞
Hi Sunil,
The correct way of running BAPIs from Web Dynpro is using Adaptive RFC.
From there go to
Creating A Web Dynpro Application Accessing ABAP Functions
Regards,
Omri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.