Skip to Content
0

Pass Custom Error messages from SAP Gateway to ui5 Frontend

Oct 19, 2016 at 09:19 AM

616

avatar image

Hi,

I have a serious requirement of passing the error messages from backend gateway to ui5 Front end.

I am using

CALL METHOD lo_message_container->add_messages_from_bapi
EXPORTING
it_bapi_messages = lt_bapi.

and then


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

But when exception is being raised the data is not displaying and only the error messages are displaying.

My Requirement is to display data as well as custom messages.
Please provide ur suggestion.

It will really be appreciated.

Thanks.

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

3 Answers

Ashwin Dutt R Oct 19, 2016 at 09:32 AM
0

Hi Supreet,

When ever you raise exception you will get only error messages which is correct.

When you say that ' the data is not displaying and only the error messages are displaying ' , it means that you are exception the input data as well to come as part of output along with error messages ?

If so you would be already having the input data in the front end application right ? as this data is only sent as input and failed with some error.

So i feel there is no need of sending back the data as well along with the error messages as part of the response from GW.

However you can still model the service so that you can send back the data as well along with the error messages as part of the response from GW. But may be you should evaluate again if you still need input data again as part of output response along with mesages.

Regards,

Ashwin

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Ashwin,
Thanks for the quick response.
I am processing the data, creating a final table in backend using my gateway service and then moving that final table to ui5 frontend ti display. But, With that final table I have some warning messages stored in separate table that I want to also display in ui5 frontend.

Summarizing my output:

One Final Table ET_ENTITYSET (Containing the final data around 50 records)

One Error Table ET_MESSAGE (Containing the warning messages)

How to get both the tables in output.

Appreciate your suggestions.

0
Ashwin Dutt R Oct 20, 2016 at 04:27 AM
0

You can get both in the output by creation association and navigation between the entities.

Between what is the operation performd here ? POST ? GET ?

Share
10 |10000 characters needed characters left characters exceeded
Cristina Rodrigues Nov 07, 2016 at 03:04 PM
0

try to use this in gateway :

RAISE EXCEPTION TYPE /IWBEP/CX_MGW_BUSI_EXCEPTION

EXPORTING
TEXTID = /IWBEP/CX_MGW_BUSI_EXCEPTION=>BUSINESS_ERROR_UNLIMITED
MESSAGE_UNLIMITED = 'Data not found'.

if you don't know which way to do in sapui5 I try send you on solution that I use sometimes

Cristina

Share
10 |10000 characters needed characters left characters exceeded