Skip to Content
0

How to send multiple messages to front-end from oData service?

Jun 10, 2017 at 03:33 PM

219

avatar image

Hi All,

In a scenario I need to validate all input values of the Fiori app whether they exist in backend or not.
I am getting all validation error messages in return message table of the FM but don't know how to send all of them to front end from oData service in response.
Please suggest or let me know if you have any pointer.

Thanks and Regards,
Amit

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Ashwin Dutt R Jun 12, 2017 at 04:25 AM
1

Hello Amit,

You can use the below code to raise an exception with table of messages from your DPC_EXT class. Please check.

data: ls_return_msg TYPE BAPIRET2.

data: lt_return_msg TYPE BAPIRET2_T.

data: lo_message TYPE REF TO /IWBEP/IF_MESSAGE_CONTAINER.

data: lx_bus_ex TYPE REF TO /IWBEP/CX_MGW_BUSI_EXCEPTION.

LO_MESSAGE = MO_CONTEXT->GET_MESSAGE_CONTAINER( ).

LO_MESSAGE->ADD_MESSAGES_FROM_BAPI( IT_BAPI_MESSAGES = LT_RETURN_MSG ).

create OBJECT lx_bus_ex

exporting message_container = LO_MESSAGE.

raise EXCEPTION lx_bus_ex.

Where LT_RETURN_MSG is a table containing all your messages.

Regards,

Ashwin

Share
10 |10000 characters needed characters left characters exceeded