cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynpro BAPI SD_SALESDOCUMENT_CREATE Commit Problem

bernd_speckmann
Contributor
0 Kudos

Hi there,

I'm trying to use the function SD_SALESDOCUMENT_CREATE within a WebDynpro Application.

I've read, that I have to call the BAPI_TRANSACTION_COMMIT after executing SD_SALESDOCUMENT_CREATE.

But when I execute it, nothing seems so be commited and there is no new salesdocument saved.

Is there anything special needs to be considered?

I just execute SD_SALESDOCUMENT_CREATE and after this I execute BAPI_TRANSACTION_COMMIT.

Thanks ahead,

Bernd

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

That should do it. Check the return values from the SD document create BAPI. Maybe there is a reason why the document isn't created?

bernd_speckmann
Contributor
0 Kudos

The SD document created seems to be ok.

When I use a custom function module calling SD_SALESDOCUMENT_CREATE and doing a commit after it everything works fine.

When I debug the function module everything seems to be ok. A document with an order number is created. But I cannot open the document because the commit doesn't work.

Any other ideas?

Any help would be greatly appreciated

former_member191044
Active Contributor
0 Kudos

Hello Bernd,

do you trigger two sepparate calls out of WD4J? Since i am no ABAP Developer, i can't tell if you have to call BAPI_TRANSACTION_COMMIT in the same request as SD_SALESDOCUMENT_CREATE. Are you able to copy SD_SALESDOCUMENT_CREATE to Z_SD_SALESDOCUMENT_CREATE and add BAPI_TRANSACTION_COMMIT at the end of the ABAP routine so you can make both operations in one call?

Regards,

Tobias

bernd_speckmann
Contributor
0 Kudos

Hi Tobias,

yes, I can copy it and it works. But I want to use the original FM.

Do I have to call the commit in the same request? How can I achieve this?

Thanks ahead

former_member191044
Active Contributor
0 Kudos

Hi Bernd,

i actually do not know a other solution than this. If you call the comit in a saparate request, there will be nothing to commit since your change was in another transaction. If would call SD_SALESDOCUMENT_CREATE out of  Z_SD_SALESDOCUMENT_CREATE and then do the commit, it would be a quite good solution since every change in SD_SALESDOCUMENT_CREATE would also be referenced in you Z RFC. But this decision belongs to you. I have no other idea.

Regards,

Tobias

Former Member
0 Kudos

Web Dynpro Java has a session concept and I know for a fact that first calling a remote enabled function module or BAPI and then calling BAPI_TRANSACTION_COMMIT as a separate RFC call works just fine. It might be required to have BAPI_TRANSACTION_COMMIT in the same model, though. There must be some other reason for what you are seeing. Can you share the exact version of your AS JAVA and AS ABAP stacks, including SP levels, patch levels, etc. Is the problem that you are not able to retrieve the document after calling commit? If not, it should be sufficient to use the WAIT = 'X' parameter for BAPI_TRANSACTION_COMMIT. If still not working, you should create a customer incident to SAP support and let them investigate, maybe there is something broken in your AS JAVA.