cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

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

Former Member
14,210

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.

Accepted Solutions (0)

Answers (8)

Answers (8)

foessleitner
SAP Champion
SAP Champion

Hi,

to avoid the COMMIT WORK issue, I used an aRFC function which executes the BAPI (CALL FUNCTION <new_arfc_function> STARTING NEW TASK <task_name> CALLING <method> ON END OF TASK. ... WAIT FOR ASYNCHRONOUS TASKS .... - Also possible is just DESTINATION 'NONE'.

Regards, Föß

umtyzc
Participant
0 Likes

Thanks Johann, Can you send example code?

nick_giannakis
Explorer

As far as I know the commit will be handled by the framework.

Even in "Save" method you will encounter the message "The command COMMIT is not allowed in a BEHAVIOR class."

Your "save" class is called in context of method "_PROCESS_SAVE_SEQUENCE" from class CL_RAP_TRANSACTION_MANAGER. That method will handle the commit. Of course all these if there are no "failed" entities.

I had a similar issue where I had to call a posting for FI documents. Due to update task usage from std tools, I had to call the FMs in background unit.

vykuntrao
Participant
0 Likes

To calll bapi_transaction_commit it needs all together separate procedure in RAP.

please refer the video using below link and try to adapt based on your need

https://www.youtube.com/watch?v=HQLM9I_Lcek&list=PLpS9_oEgVsZ3yxVjGDCXxhtJEMiZJYXtm&index=2&t=15s

Former Member
0 Likes

Is there a solution here in the meantime? I am currently facing the problem myself and would like to execute a BAPI in a RAP managed scenario.

I would be particularly interested in how exactly the call should take place. Somehow it doesn't seem to work in the same LUW.

piyush_83177
Discoverer
0 Likes

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?

RajuSubba
Participant
0 Likes

You can create as RFC FM inside of it can write BAPI logic and call as below starting new task & destination as None

CALL FUNCTION 'ZRFC_FM'

STARTING NEW TASK 'UPDATE'

DESTINATION 'NONE'.

0 Likes

Hi nick.giannakis

Our requirement is also similar,
However, our business object does not get updated via BAPI_TRANSACTION_COMMIT.
We have to use a different COMMIT (diwps_rev_save ) and for this, we need to pass the values from the corresponding method to SAVE( standard method provided by RAP). How do I pass those values in the SAVE method?

Any idea on this?

Regards,

former_member683250
Discoverer
0 Likes

I have also encountered the same issue. BAPI internally calls a commit work and we have second commit by the framework.

I have updated comments here -

https://blogs.sap.com/2019/05/23/sap-cloud-platform-abap-restful-programming-model-rap-for-beginners...

Here is Runtime Error that we get -

What happened?

Error in the ABAP application program.

The current ABAP program “SAPMV45A” had to be terminated because it found a
statement that could not be executed.

Error analysis

There is probably an error in the program
“SAPMV45A”.
A BEHAVIOR implementation is active for XYZ While this is the case,
the following ABAP statements are illegal:

– COMMIT
– ROLLBACK
– SUBMIT
– CALL TRANSACTION
– LEAVE
all DYNPRO-related statements, such as MESSAGE, CALL DIALOG, and CALL
SCREEN

The following statement is only allowed in the “Save” phase: – CALL
FUNCTION IN UPDATE TASK

RajuSubba
Participant
0 Likes

Have u find any solution for this