-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathRaisingExceptions
More file actions
26 lines (20 loc) · 1.15 KB
/
Copy pathRaisingExceptions
File metadata and controls
26 lines (20 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---------------------- * Option 1: Using Message Container---------------------------------
DATA lo_message_container TYPE REF TO /iwbep/if_message_container.
" get message container object
lo_message_container = mo_context->get_message_container( ).
*Option 1.1 - Add message from BAPI (BAPIRET2)
CALL METHOD lo_message_container->add_messages_from_bapi
EXPORTING
it_bapi_messages = lt_return "This has to be of type BAPIRET2
iv_determine_leading_msg = /iwbep/if_message_container=>gcs_leading_msg_search_option-first.
*Option 1.2
*Raise Exception
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
message_container = lo_message_container.
---------------------- *Option 2: Direct Use. Without /iwbep/if_message_container---------------------------------
MESSAGE e000(Zmessage_class) INTO DATA(lv_message) WITH sy-uname.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>business_error_unlimited
message_unlimited = lv_message.