|
1 | 1 | --- |
2 | 2 | outline: [2, 4] |
3 | 3 | --- |
4 | | -# Messages |
5 | 4 |
|
6 | | -For translation, check this section. |
| 5 | +# Messages |
7 | 6 |
|
8 | 7 | #### Message Toast |
9 | 8 |
|
| 9 | +Messages only displayed for a short period of time eg. sucesses can be displayed via the client method: |
| 10 | + |
| 11 | +```abap |
| 12 | +CLASS zcl_my_app IMPLEMENTATION. |
| 13 | + METHOD z2ui5_if_app~main. |
| 14 | +
|
| 15 | + client->message_toast_display( `this is my message` ). |
| 16 | +
|
| 17 | + ENDMETHOD. |
| 18 | +ENDCLASS. |
| 19 | +``` |
10 | 20 |
|
11 | 21 | #### Message Box |
12 | 22 |
|
| 23 | +Messages wihch need to be closed manually can be displayed via the message box: |
| 24 | + |
| 25 | +```abap |
| 26 | +CLASS zcl_my_app IMPLEMENTATION. |
| 27 | + METHOD z2ui5_if_app~main. |
| 28 | +
|
| 29 | + client->message_box_display( `this is my message` ). |
| 30 | +
|
| 31 | + ENDMETHOD. |
| 32 | +ENDCLASS. |
| 33 | +``` |
| 34 | + |
| 35 | +Or use an error |
| 36 | + |
| 37 | +```abap |
| 38 | +CLASS zcl_my_app IMPLEMENTATION. |
| 39 | + METHOD z2ui5_if_app~main. |
| 40 | + client->message_box_display( text = 'Select a team in the "Development" area.' && cl_abap_char_utilities=>cr_lf && |
| 41 | + '"Marketing" isn’t assigned to this area.' type = 'error' ). |
| 42 | +
|
| 43 | + ENDMETHOD. |
| 44 | +ENDCLASS. |
| 45 | +``` |
13 | 46 |
|
14 | 47 | #### Popup T100/BAPIRET |
15 | | -Most often you will get Message Popups in T100 or bairet format, you can use the following popup to display these messages: |
| 48 | + |
| 49 | +```abap |
| 50 | +CLASS z2ui5_cl_demo_app_154 IMPLEMENTATION. |
| 51 | + METHOD z2ui5_if_app~main. |
| 52 | +
|
| 53 | + DATA(lo_app) = z2ui5_cl_pop_messages=>factory( VALUE #( |
| 54 | + ( message = 'An empty Report field causes an empty XML Message to be sent' type = 'E' id = 'MSG1' number = '001' ) |
| 55 | + ( message = 'Check was executed for wrong Scenario' type = 'E' id = 'MSG1' number = '002' ) |
| 56 | + ( message = 'Request was handled without errors' type = 'S' id = 'MSG1' number = '003' ) |
| 57 | + ( message = 'product activated' type = 'S' id = 'MSG4' number = '375' ) |
| 58 | + ( message = 'check the input values' type = 'W' id = 'MSG2' number = '375' ) |
| 59 | + ( message = 'product already in use' type = 'I' id = 'MSG2' number = '375' ) |
| 60 | + ) ). |
| 61 | +
|
| 62 | + client->nav_app_call( lo_app ). |
| 63 | +
|
| 64 | + ENDMETHOD. |
| 65 | +ENDCLASS. |
| 66 | +``` |
| 67 | + |
| 68 | +if you need interaction, you can use built-in popups. The commen messages in format T100 or bairet, you can use the following popup to display these messages: |
| 69 | + |
16 | 70 | PRs welcome |
17 | 71 |
|
18 | 72 | #### Popup To Inform |
19 | | -Popup |
20 | 73 |
|
| 74 | +Popup |
21 | 75 |
|
22 | | -#### Popup To Decide |
23 | | - |
| 76 | +#### Popup To Decide |
0 commit comments