Skip to content

Commit 604a8c7

Browse files
authored
Update messages.md
1 parent 6e679ca commit 604a8c7

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

docs/development/messages.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Displaying messages and errors is an everyday requirement for ABAP developers. T
1111
For short-duration messages, such as success notifications, you can use the message toast:
1212

1313
```abap
14-
METHOD z2ui5_if_app~main.
14+
METHOD z2ui5_if_app~main.
1515
1616
client->message_toast_display( `this is a message` ).
1717
@@ -23,7 +23,7 @@ ENDMETHOD.
2323
Want the user to acknowledge the message? You can display a message box that requires manual closure:
2424

2525
```abap
26-
METHOD z2ui5_if_app~main.
26+
METHOD z2ui5_if_app~main.
2727
2828
client->message_box_display( `this is a message` ).
2929
@@ -33,7 +33,7 @@ ENDMETHOD.
3333
For error messages, simply change the type:
3434

3535
```abap
36-
METHOD z2ui5_if_app~main.
36+
METHOD z2ui5_if_app~main.
3737
3838
client->message_box_display(
3939
text = `This is an error message`
@@ -46,7 +46,7 @@ ENDMETHOD.
4646
You can directly pass common message structures, objects, and variables to the functions:
4747
###### SY
4848
```abap
49-
METHOD z2ui5_if_app~main.
49+
METHOD z2ui5_if_app~main.
5050
5151
MESSAGE ID `NET` TYPE `I` NUMBER `001` INTO DATA(lv_dummy).
5252
client->message_box_display( sy ).
@@ -55,7 +55,7 @@ ENDMETHOD.
5555
```
5656
###### BAPIRET
5757
```abap
58-
METHOD z2ui5_if_app~main.
58+
METHOD z2ui5_if_app~main.
5959
6060
DATA lt_bapiret TYPE STANDARD TABLE OF bapiret2.
6161
CALL FUNCTION `BAPI_USER_GET_DETAIL`
@@ -71,7 +71,7 @@ ENDMETHOD.
7171
```
7272
###### CX_ROOT
7373
```abap
74-
METHOD z2ui5_if_app~main.
74+
METHOD z2ui5_if_app~main.
7575
7676
TRY.
7777
DATA(lv_val) = 1 / 0.
@@ -86,7 +86,7 @@ Other imports are supported as well. Just import your message structure, and the
8686
#### Popup Multi Message
8787
The message box provides basic output. For a more detailed output, use the popup `z2ui5_cl_pop_messages`:
8888
```abap
89-
METHOD z2ui5_if_app~main.
89+
METHOD z2ui5_if_app~main.
9090
9191
DATA(lt_msg) = VALUE bapirettab(
9292
( type = `E` id = `MSG1` number = `001` message = `An empty Report field causes an empty XML Message to be sent` )
@@ -99,7 +99,7 @@ ENDMETHOD.
9999
#### Popup Error
100100
To show a detailed view of your exception, use the following code:
101101
```abap
102-
METHOD z2ui5_if_app~main.
102+
METHOD z2ui5_if_app~main.
103103
104104
TRY.
105105
DATA(lv_val) = 1 / 0.
@@ -111,22 +111,27 @@ ENDMETHOD.
111111
```
112112

113113
#### Uncaught Errors
114-
What happens if errors are uncaught? In this case, the default HTTP handler exception output is used. The processing is interrupted, and the user will need to refresh the browser. Use this only for unexpected behavior:
114+
When you don't catch exceptions in your code, the framework catches them and shows the standard error popup. Try:
115+
115116
```abap
116117
METHOD z2ui5_if_app~main.
117118
118-
ASSERT 1 = `This is an error message!`.
119+
RAISE EXCEPTION NEW cx_sy_itab_line_not_found( ).
119120
120121
ENDMETHOD.
121122
```
122-
Alternatively, achieve the same behavior with an uncaught exception:
123+
124+
#### Uncatchable Exceptions / Short Dumps
125+
What happens if your code creates uncatchable exceptions? In this case, the default HTTP handler exception output is used. The processing is interrupted, and the user will need to refresh the browser. Use this only for unexpected behavior:
126+
123127
```abap
124-
METHOD z2ui5_if_app~main.
128+
METHOD z2ui5_if_app~main.
125129
126-
RAISE EXCEPTION NEW cx_sy_itab_line_not_found( ).
130+
ASSERT 1 = `This is an error message!`.
127131
128132
ENDMETHOD.
129133
```
134+
130135
::: tip **Improvements**
131136
These message functions are continually being improved. Feel free to open an issue if you encounter errors or incompatibilities, or submit a PR to extend the functionality.
132137
:::

0 commit comments

Comments
 (0)