on 10-30-2006 11:17 AM
Hi experts.
I have a problem with jco. I made a jsp page including jco that calls a CBO function module(RFC). When I run the page with debug mode, commit work is executed. But it's not work non-debug mode even though I execute 'BAPI_TRANSACTION_COMMIT' on the page. I don't know why it's not work. Below code is mine.
public String fileDocTest(String doc, String doctype) {
JCO.Client client = null;
JCO.Repository rep = null;
JCO.Function function = null;
JCO.Function function_comm = null;
String rstring = "";
String docnum ="";
String temp = "1";
String temp1 = "SAP-SYSTEM";
try
{
client = SAPConnectionPool.getInstance().getConnection();
rep = new JCO.Repository(repositoryName, client);
CreateFunction crtFnc = new CreateFunction(rep);
CreateFunction crtFnc2 = new CreateFunction(rep);
function_comm = crtFnc.createFunction("BAPI_TRANSACTION_COMMIT");
function = crtFnc2.createFunction("Z_1EH_UPLOAD_DOC_2");
JCO.setMiddlewareProperty("jco.middleware.allow_start_of_programs","ftp;sapftp;sapftpa;sapkprotp;http;saphttp;saphttpa");
JCO.Structure imp_f_table_00 = function.getImportParameterList().getStructure("DOCUMENTDATA");
imp_f_table_00.setValue("CPD","DOCUMENTTYPE");
imp_f_table_00.setValue("CFPDOC","DESCRIPTION");
JCO.Table imp_f_table_01 = function.getTableParameterList().getTable("DOCUMENTDESCRIPTIONS");
imp_f_table_01.appendRow();
imp_f_table_01.setValue("EN","LANGUAGE");
imp_f_table_01.setValue("CfPDoc","DESCRIPTION");
JCO.Table imp_f_table_02 = function.getTableParameterList().getTable("DOCUMENTFILES");
imp_f_table_02.appendRow();
imp_f_table_02.setValue( "1","ORIGINALTYPE");
imp_f_table_02.setValue( "SAP-SYSTEM","STORAGECATEGORY"); imp_f_table_02.setValue(doc,"DOCPATH");
imp_f_table_02.setValue(doctype,"WSAPPLICATION");
client.execute(function);
client.execute(function_comm);
JCO.ParameterList exp_f_table = function.getExportParameterList();
}
catch (Exception ex)
{
ex.printStackTrace();
System.out.println("Caught an exception: \n" + ex);
}
finally
{
JCO.releaseClient(client);
return docnum;
}
FM Z_1EH_UPLOAD_DOC_2 calls a standard FM API_DOCUMENT_MAINTAIN2.
If you have any inforamtion about JCO commit error, please let me know.
Regards.
Hi,
why did you not call the bapi_transaction_commit at the end of the function "Z_1EH_UPLOAD_DOC_2"?
I never try something like that you wrote, but i think the problem is, that you call the SAP via JCO two times and sap cannot link the "commit" in the second function to the first "Z_1EH_UPLOAD_DOC_2" function call.
best regards,
Nils
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nils.
Frankly I say, I try to commit in the source code of 'Z_1EH_UPLOAD_DOC_2" fucntion like below.
CALL FUNCTION 'API_DOCUMENT_MAINTAIN2'
EXPORTING: pf_transaction = 'CV01'
documentdata = documentdata
hostname = hostname
change_number = docbomchangenumber
valid_from = docbomvalidfrom
revision_level = docbomrevisionlevel
pf_ftp_dest = pf_ftp_dest
pf_http_dest = pf_http_dest
CAD_MODE = CAD_MODE
IMPORTING: documenttype = documenttype
documentnumber = documentnumber
documentpart = documentpart
documentversion = documentversion
return = return
TABLES: characteristicvalues = characteristicvalues
classallocations = classallocations
documentdescriptions = documentdescriptions
objectlinks = objectlinks
documentstructure = documentstructure
documentfiles = documentfiles
longtext = longtexts
components = components.
if return-type is initial or return-type = 'S'.
commit work.
if sy-subrc = 0.
if return-type is initial.
return-type = 'S'.
return-message = documentnumber.
endif.
else.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
if sy-subrc = 0.
return-type = 'S'.
return-message = documentnumber.
endif.
endif.
else.
return-type = 'E'.
endif.
But, it's not work too. So, I tried to commit at JCO code. Is there any kind of problem?
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.