cancel
Showing results for 
Search instead for 
Did you mean: 

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

cmetz
Participant
0 Kudos

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

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

maheshpalavalli
Active Contributor
0 Kudos

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.ht...

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

BR,

Mahesh

cmetz
Participant
0 Kudos

Hi @Mahesh Kumar Palavalli,

thanks for your help. I changed the method changeset_process and implemented the message container (see screenshot). Still the same behavior. The response contains only the generic error message.

Any further ideas?

Chris

3.png

maheshpalavalli
Active Contributor
0 Kudos

No just call like below.

RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
      EXPORTING
          message_container = io_message_container. 

BR,

Mahesh

cmetz
Participant
0 Kudos

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