2007 Feb 03 10:21 AM
Hey,
I'm using BAPI_TRANSACTION_COMMIT to commit an invoice (BAPI_INCOMINGINVOICE_CREATE) out of a Java Programm. I'm using the SAP Enterprise Connector to create Proxy-Classes for Java. Problem: ret.getMessage() is always empty and nothing is commited. Some ideas? That's my Code:
jcoclient.connect();
Connector_PortType myproxy = new Connector_PortType();
Commit_PortType commitProxy = new Commit_PortType();
myproxy.messageSpecifier.setJcoClient(jcoclient);
commitProxy.messageSpecifier.setJcoClient(jcoclient);
String returnString = "Error during transmitting the data! Check required fields!";
try {
// BAPI Invoice call
Bapi_Incominginvoice_Create_Output output = myproxy.bapi_Incominginvoice_Create(input);
Bapiret2Type[] returns = output.getReturn();
if(returns.length == 1) {
returnString = "Invoice transmitted successfully!"; //Thats OK
// Commit call
Bapi_Transaction_Commit_Input transInput = new Bapi_Transaction_Commit_Input();
transInput.setWait("X");
Bapi_Transaction_Commit_Output transOutput = commitProxy.bapi_Transaction_Commit(transInput);
commit.Bapiret2Type ret = transOutput.getReturn();
returnString = returnString + " - "+ret.getMessage(); // ret.getMessage is always empty
Thanks in advance!
Regards
Michael
Hi,
it is difficult to understand your coding, since you obviously have your own wrapper classes for the JCO classes. But one possible reason could be:
You do a connect for the bapi call and a separate connect for the transaction commit. If the second one is a new connect to the R/3 system, you are in a different LUW and the commit has no impact on the update tasks of the first bapi call.
One solution could be: Build your own ABAP wrapper for the BAPI, which does already a commit, and call this wrapper by JCO.
Best regards,
Thomas
2007 Feb 03 7:09 PM
Hi
I don't get your problem. Do you mean, the BAPI is not saving the data in this case.
Once your Invoice gets succesfully created, Why you expect a message after using BAPI_TRANSACATION_COMMIT. Is there any specific requirement, where you want to display the message.
I don't think you should be using return tables in BAPI_TRANSACTION_COMMIT, here.
Pls check again, without specifying return tables in BAPI_TRANSACTION_COMMIT.
Hope this will help.
Pls reward suitable points.
Regards
- Atul
2007 Feb 03 7:26 PM
2007 Feb 03 8:22 PM
Hi,
it is difficult to understand your coding, since you obviously have your own wrapper classes for the JCO classes. But one possible reason could be:
You do a connect for the bapi call and a separate connect for the transaction commit. If the second one is a new connect to the R/3 system, you are in a different LUW and the commit has no impact on the update tasks of the first bapi call.
One solution could be: Build your own ABAP wrapper for the BAPI, which does already a commit, and call this wrapper by JCO.
Best regards,
Thomas
2007 Feb 04 8:58 PM
I think the commit may never be called because of:
if(returns.length == 1)
The RETURNS table is generally not empty after the initail BAPI call if it was successful.
Rob
2007 Feb 05 2:48 AM
There is no problem calling BAPI_COMMIT even if the invoice create had errors. The only reason to not commit is if you are calling a series of BAPIs and want to only commit if all the BAPI calls are successful.
So to bring together some of the earlier comments, you could put the BAPI_COMMIT in the wrapper for the BAPI_INCOMINGINVOICE_CREATE and call it regardless of the result.
Michael
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |