cancel
Showing results for 
Search instead for 
Did you mean: 

SAVE Sequence BAPI Commit Issue, ABAP RESTful Programming On-Premise

reachoutnagendra
Explorer

Hi Experts,

I am trying to implement unmanaged scenario for a create operation. I am using 'BAPI_EPM_SO_CREATE' to create a sales order with create method.

This BAPI has a parameter 'persist_to_db' which is by default true. When I am calling the BAPI , getting dump because the BAPI contains 'COMMIT WORK'. As we know we cannot use commit work during transnational phase.

So then passed 'abap_false' to persist_to_db and placed commit work in save method (part of save sequence). But still I am getting dump for using commit.

Due to this reason I am unable to persist the data even after successful execution of the BAPI. How do I commit the data in save seqeunce. Kindly help.

Regards,

ABAPer.

Sandra_Rossi
Active Contributor
0 Kudos

COMMIT WORK leads to a runtime error (please give details about your runtime error) when it's called inside an update task (your case?). The only way to trigger an update task is to use COMMIT WORK, so when you call the BAPI you're already inside COMMIT WORK.

In fact, that's a scenario to avoid: don't call a BAPI inside the update task. The solution depends on your exact scenario. Eventually one possibility is to call the BAPI inside a separate SAP LUW, for instance via tRFC (DESTINATION 'NONE' IN BACKGROUND TASK).

reachoutnagendra
Explorer
0 Kudos

Hi , This is the error 'cannot use commit work during transnational phase.' I was getting. FYI I am asking this question in the context of ABAP RESTful Programming.

As per my understanding we cannot use 'Commit work' in interactive phase, so I have decided to keep the commit work in save sequence.(Save method), still getting the same error. How do I commit the data in this scenario. perhaps andre.fischer could help me on this 🙂

former_member515329
Participant
0 Kudos

Hello sandra.rossi ,

What is the solution for this type of issues :

Even i am able to create a SO in debug mode - but it is not visible in VA03 tcode - if i try to write the commit statement - it is throwing dump.

Without Commit, how can the SO will be saved in database?

Please help.

Sandra_Rossi
Active Contributor
0 Kudos

ravi.kumar183 My comment was not relevant for this RAP question. I suggest that you first try your code separately as a simple test Executable program (type 1) including a COMMIT WORK and see whether it works. If yes, as far as I understand what is said here about RAP, COMMIT WORK should not be present in your code and is done by the RAP framework.

former_member515329
Participant
0 Kudos

Thanks for your reply.

But when will commit happen?

As i need the SO number to be captured after the BAPI call - if i forcefully write commit, then DUMP is occured.

Is there any workaround to get the SO number to be saved in database after the BAPI call.

View Entire Topic
piyush_831
Discoverer
0 Kudos

Hello reachoutnagendra,

I am also trying the same thing but I am not able to pass multiple item records from the UI to backend to call the BAPI, can you explain how you achieved this?