You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/development/events.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@ You can trigger backend processing when an event occurs using the `client->_even
12
12
As an example, we will use the `press` property of a button. To trigger events in the backend, assign the result of `client->_event(`MY_EVENT_NAME`)` to the relevant UI5 control property. Once triggered, the backend can retrieve the event details with `client->get( )-event`.
13
13
14
14
```abap
15
-
METHOD z2ui5_if_app~main.
16
-
15
+
METHOD z2ui5_if_app~main.
16
+
17
17
client->view_display( z2ui5_cl_xml_view=>factory(
18
18
)->button(
19
19
text = `post`
@@ -32,8 +32,8 @@ If the backend needs additional information about the specific event, use parame
32
32
#### Source
33
33
Send properties of the event source control to the backend:
34
34
```abap
35
-
METHOD z2ui5_if_app~main.
36
-
35
+
METHOD z2ui5_if_app~main.
36
+
37
37
client->view_display( z2ui5_cl_xml_view=>factory(
38
38
)->button( text = `post` press = client->_event(
39
39
val = `BUTTON_POST`
@@ -51,8 +51,8 @@ ENDMETHOD.
51
51
#### Parameters
52
52
Retrieve parameters of the event:
53
53
```abap
54
-
METHOD z2ui5_if_app~main.
55
-
54
+
METHOD z2ui5_if_app~main.
55
+
56
56
client->view_display( z2ui5_cl_xml_view=>factory(
57
57
)->button( text = `post` id = `button_id` press = client->_event(
58
58
val = `BUTTON_POST`
@@ -71,8 +71,8 @@ ENDMETHOD.
71
71
#### Event
72
72
Retrieve specific properties of the event:
73
73
```abap
74
-
METHOD z2ui5_if_app~main.
75
-
74
+
METHOD z2ui5_if_app~main.
75
+
76
76
client->view_display( z2ui5_cl_xml_view=>factory(
77
77
)->button( text = `post` press = client->_event(
78
78
val = `BUTTON_POST`
@@ -102,8 +102,8 @@ CLASS z2ui5_cl_app_hello_world DEFINITION PUBLIC CREATE PUBLIC.
102
102
103
103
ENDCLASS.
104
104
105
-
METHOD z2ui5_if_app~main.
106
-
105
+
METHOD z2ui5_if_app~main.
106
+
107
107
client->view_display( z2ui5_cl_xml_view=>factory(
108
108
)->input( client->_bind_edit( name )
109
109
)->button( text = `post` press = client->_event(
@@ -144,8 +144,8 @@ If you don't want to process the event in the backend, you can also directly tri
144
144
```
145
145
For example, to open a new tab with the corresponding event:
146
146
```abap
147
-
METHOD z2ui5_if_app~main.
148
-
147
+
METHOD z2ui5_if_app~main.
148
+
149
149
client->view_display( z2ui5_cl_xml_view=>factory(
150
150
)->button(
151
151
text = `post`
@@ -160,7 +160,7 @@ ENDMETHOD.
160
160
### Follow Up Action
161
161
Sometimes, you might want to first call a backend function and then immediately perform an action in the frontend. This is possible with the follow-up action event:
Copy file name to clipboardExpand all lines: docs/development/messages.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Displaying messages and errors is an everyday requirement for ABAP developers. T
11
11
For short-duration messages, such as success notifications, you can use the message toast:
12
12
13
13
```abap
14
-
METHOD z2ui5_if_app~main.
14
+
METHOD z2ui5_if_app~main.
15
15
16
16
client->message_toast_display( `this is a message` ).
17
17
@@ -23,7 +23,7 @@ ENDMETHOD.
23
23
Want the user to acknowledge the message? You can display a message box that requires manual closure:
24
24
25
25
```abap
26
-
METHOD z2ui5_if_app~main.
26
+
METHOD z2ui5_if_app~main.
27
27
28
28
client->message_box_display( `this is a message` ).
29
29
@@ -33,7 +33,7 @@ ENDMETHOD.
33
33
For error messages, simply change the type:
34
34
35
35
```abap
36
-
METHOD z2ui5_if_app~main.
36
+
METHOD z2ui5_if_app~main.
37
37
38
38
client->message_box_display(
39
39
text = `This is an error message`
@@ -46,16 +46,16 @@ ENDMETHOD.
46
46
You can directly pass common message structures, objects, and variables to the functions:
47
47
###### SY
48
48
```abap
49
-
METHOD z2ui5_if_app~main.
50
-
51
-
MESSAGE ID `NET` TYPE `I` NUMBER `001` into data(lv_dummy).
49
+
METHOD z2ui5_if_app~main.
50
+
51
+
MESSAGE ID `NET` TYPE `I` NUMBER `001` INTO DATA(lv_dummy).
52
52
client->message_box_display( sy ).
53
53
54
54
ENDMETHOD.
55
55
```
56
56
###### BAPIRET
57
57
```abap
58
-
METHOD z2ui5_if_app~main.
58
+
METHOD z2ui5_if_app~main.
59
59
60
60
DATA lt_bapiret TYPE STANDARD TABLE OF bapiret2.
61
61
CALL FUNCTION `BAPI_USER_GET_DETAIL`
@@ -71,7 +71,7 @@ ENDMETHOD.
71
71
```
72
72
###### CX_ROOT
73
73
```abap
74
-
METHOD z2ui5_if_app~main.
74
+
METHOD z2ui5_if_app~main.
75
75
76
76
TRY.
77
77
DATA(lv_val) = 1 / 0.
@@ -83,12 +83,12 @@ ENDMETHOD.
83
83
```
84
84
Other imports are supported as well. Just import your message structure, and the message box will display it.
85
85
86
-
#### Popup Multi Message
86
+
#### Popup Multi Message
87
87
The message box provides basic output. For a more detailed output, use the popup `z2ui5_cl_pop_messages`:
88
88
```abap
89
-
METHOD z2ui5_if_app~main.
89
+
METHOD z2ui5_if_app~main.
90
90
91
-
data(lt_msg) = value bapirettab(
91
+
DATA(lt_msg) = VALUE bapirettab(
92
92
( type = `E` id = `MSG1` number = `001` message = `An empty Report field causes an empty XML Message to be sent` )
93
93
( type = `I` id = `MSG2` number = `002` message = `Product already in use` ) ).
94
94
@@ -99,7 +99,7 @@ ENDMETHOD.
99
99
#### Popup Error
100
100
To show a detailed view of your exception, use the following code:
101
101
```abap
102
-
METHOD z2ui5_if_app~main.
102
+
METHOD z2ui5_if_app~main.
103
103
104
104
TRY.
105
105
DATA(lv_val) = 1 / 0.
@@ -113,15 +113,15 @@ ENDMETHOD.
113
113
#### Uncaught Errors
114
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:
115
115
```abap
116
-
METHOD z2ui5_if_app~main.
116
+
METHOD z2ui5_if_app~main.
117
117
118
118
ASSERT 1 = `This is an error message!`.
119
119
120
120
ENDMETHOD.
121
121
```
122
122
Alternatively, achieve the same behavior with an uncaught exception:
0 commit comments