Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] OData Message Container

When dealing with standard HCM Fiori Applications, it can be handy to provide custom error messages when adding additional checks. This can easily be done using the message container.

        DATA(lo_message_container) = mo_context->get_message_container( ).
        lo_message_container->add_messages_from_bapi( it_bapi_messages          = VALUE #( ( type = 'E' message = 'This is a custom error.' ) )
                                                      iv_determine_leading_msg  = /iwbep/if_message_container=>gcs_leading_msg_search_option-last
                                                      iv_add_to_response_header = abap_true ).
        RAISE EXCEPTION NEW /iwbep/cx_mgw_busi_exception( ).

Leave a Reply

Your email address will not be published. Required fields are marked *