Skip to Content

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

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.



Add a comment
10|10000 characters needed characters exceeded

  • 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).

  • 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 :)

Related questions

2 Answers

  • Posted on Jun 22 at 10:46 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 07 at 02:03 PM

    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 -

    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
    A BEHAVIOR implementation is active for XYZ While this is the case,
    the following ABAP statements are illegal:

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

    The following statement is only allowed in the “Save” phase: – CALL

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.