cancel
Showing results for 
Search instead for 
Did you mean: 

Remote OData Consumption Model on SAP BTP, ABAP Environment: How to get the Message Container?

alrikx
Explorer
0 Kudos

I'm using a remote consumption model to consume an OData service.

I can check if an error occured w/:

try.
    request->check_execution(  ) 
  CATCH /iwbep/cx_gateway INTO DATA(gateway_exception).
    [...]
endtry.

with the debugger I can see, that from the thrown exception, there is a previous reference of type CX_ROOT but instance is of type /IWBEP/CX_MGW_BUSI_EXCEPTION.

That exception contains the message container with further valueable detail messages. In my case that a material was not found:

I fail trying to access the previous reference because I can't upcast to /IWBEP/CX_MGW_BUSI_EXCEPTION as it is not a released object.

How can these messages be retrieved in BTP ABAP Environment?

Thank You in advance!

alrikx
Explorer
0 Kudos

Hey andre.fischer,
I often use and really enjoy your blogposts in that area, maybe you have an idea how to do that.

Thanks a lot!

Alrik

Accepted Solutions (0)

Answers (1)

Answers (1)

bernhard_grusie
Advisor
Advisor
0 Kudos

Hi Alrik, our recommendation is to also use the remote exception to get the error message.

CATCH /iwbep/cx_cp_remote INTO DATA(lx_remote).

" Handle remote Exception

" It contains details about the problems of your http(s) connection

CATCH /iwbep/cx_gateway INTO DATA(lx_gateway).

" Handle Exception

ENDTRY.

However, is the get_message_container method of /iwbep/cx_gateway helpful?

Kind regards

Bernhard