Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jun 12, 2017 at 04:25 AM

    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

    Add comment
    10|10000 characters needed characters exceeded