cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with BAPI_PO_CHANGE & BAPI_TRANSACTION_COMMIT

Former Member
0 Kudos

Hi there!

I've got a little problem with changing orders in SAP R/3 via Adaptive RFC using the above mentioned BAPIS.

When I call the first one - either changing an order-position or a disposition - , it returns the Message "order xxx changed successfully".

Afterwards, I call the 2nd bapi to commit the transaction, which returns an empty line.

Unfortunatly, neither the changes have been adopted nor the lock on the tables EKKO & EKPO is released and - additionally - I find the RFC session to be still open.

Any comments are more than appreciated!

BR

Thomas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Thomas,

Are you returning Messege "order xxx changed successfully" from the BAPI itself? or you are showing this messege from your webdynpro application only?

And have you checked that you BAPI is working correctly with the same data when you test it in R/3 only?

Check the same for another BAPI.

And for open connections, by default your models are set to Application scope and because of this it will retain connections. If you want to close this connections you have to write following one line code after executing your model.

wdcontext.current<node name>element().modelObject().modelInstance().disconnectIfAlive();

it will close your connection to the SAP R/3.

Regards,

Bhavik

Former Member
0 Kudos

Hi, Bhavik!

Thank you very much for your answer!

The message "... successfully" comes from the BAPI, which works fine when testing it in SE37. I also only try to commit the transaction, if the change-bapi returns "S" for success.

Inserted the disconnectIfAlive() into the finally-clause of my execution-block, but unfortunatly didn't do its job.

Any ideas? Once again thanks for your kind efforts!

BR

Thomas

Former Member
0 Kudos

Hi Thomas

Well first of all i dont think there is a problem with your Commit. Well like Bhavik suggested always ensure to close the connection if not used.

Ensure that you have not selected TESTRUN import parameter. This will just simulate and will not create a PO.

Second if you have set some parameters in the import structure "PO_HEADER" then ensure that the same parameters are set to 'X' in the import structure "PO_HEADERX".

As far as i can see this could be one of your problem.Check and let me know.

Hope that was helpful.

regards

ravi

Former Member
0 Kudos

Hi Thomas,

To disconnect from SAP R/3 try the following code if privious one is not working.

<Model name> model = (<Model name>) WDModelFactory.getModelInstance(<Model name>.class);

model.disconnectIfAlive();

Regards,

Bhavik

Former Member
0 Kudos

Hello, Ravi!

Thanks a lot for your hint.

I've checked the TESTRUN parameter as well as the existence of all change-flags in the "...X"-tables and also freed the connection after the RFC-call, but it's still not working.

Any more ideas?

Best Regards,

Thomas

Former Member
0 Kudos

Try building a wrapper around the BAPI's which you call from your Web Dynpro. This wrapper has the same interface as BAPI_PO_CHANGE. The wrapper first calls BAPI_PO_CHANGE, then checks BAPI_RETURN for an 'S' message and calls BAPI_TRANSACTION_COMMIT if required.

This has three advantages:

1. Only one RFC call

2. Improved performance

3. Your Web Dynpro implementation becomes simpler

Answers (0)