Skip to Content

SAP Gateway Changeset - Error handling -> Error Message Rollback because of error

Hey guys,

I developed a batch request as changeset (Multiple create, update, delete operations). If an error occured in a single operation I raise exception /iwbep/cx_mgw_busi_exception with a custom message (see method changeset_process). The custom message is captured in /IWBEP/ERROR_LOG but the response shows a generic error message: "Rollbacked because of error during changeset processing (/iwbep/cm_mgw_rt, 049).

I want to populate all my custom messages to the response, so that the messages can be shown in the frontend.

How can I achieve that? Thanks for your help.

Chris

1.png2.png

1.png (15.8 kB)
2.png (9.9 kB)
Add a comment
10|10000 characters needed characters exceeded

  • Hello Christoph, did you find a solution to your problem?

    We have a similar scenario: When raising a /iwbep/cx_mgw_busi_exception during changeset_process the message gets overwritten by "Rollbacked because of error during changeset processing".

    This only happens in the cloud (OData Provisioning/Gateway as a Service). In our on-premise environment everything works as expected.

Related questions

1 Answer

  • Posted on Feb 14, 2019 at 07:36 PM

    Hi Christoph Metz

    You need to use the message container and add all the messages to it. At the end raise the exception by passing the message container to it.

    For code you can see the below example on how to access the message container and add the messages:

    https://archive.sap.com/discussions/thread/3470565

    http://www.saplearners.com/map-message-odata-response-header-sap-message/

    https://help.sap.com/saphelp_gateway20sp12/helpdata/en/25/21aecce9db435daaea433071ff7d94/frameset.htm

    Don't forget to pass the message container to the exception you will raise.

    BR,

    Mahesh

    Add a comment
    10|10000 characters needed characters exceeded

    • Hey Mahey,

      the method changeset_process doesn't have a parameter io_message_container.

      I tried following, but still not working:

        METHOD /iwbep/if_mgw_appl_srv_runtime~changeset_process.
          DATA: ls_changeset_respone TYPE /iwbep/if_mgw_appl_types=>ty_s_changeset_response.
      
          LOOP AT it_changeset_request ASSIGNING FIELD-SYMBOL(<s_changeset_request>).
            "DATA(lo_message_container) = me->/iwbep/if_mgw_conv_srv_runtime~get_message_container( ).
            <s_changeset_request>-msg_container->add_message( iv_msg_type   = 'E'
                                                              iv_msg_id     = '/ZTEST/BC'
                                                              iv_msg_number = 009
                                                              iv_msg_v1     = 'TEST' ).
      
      
            RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
              MESSAGE ID '/ZTEST/BC'
              TYPE 'E'
              NUMBER 001
              EXPORTING
                message_container = <s_changeset_request>-msg_container.
      
      
          ENDLOOP.
      ENDMETHOD

      Regards

      Chris

      5.png

      5.png (11.2 kB)

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.