Skip to content

Commit 8a90cc5

Browse files
authored
Update srtti.md
1 parent 5d4c6a5 commit 8a90cc5

File tree

1 file changed

+77
-2
lines changed

1 file changed

+77
-2
lines changed

docs/addons/srtti.md

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
11
# Runtime Typed Data with S-RTTI
22

3-
<i class="fa-brands fa-github"></i> [Repository](https://github.com/sandraros/S-RTTI)
3+
<i class="fa-brands fa-github"></i> [S-RTTI on GitHub](https://github.com/sandraros/S-RTTI)
44

5-
abap2UI5 serializes your app instances to ensure stateless behavior in client communication. Unfortunately, the sap standard transformation features are limited, for example not supporting local types created at runtime. Fortunately the project S-RTTI fills this gap. Install it and make full use of dynamic popups, typing, and runtime-created apps.
5+
In abap2UI5 musst du nicht nowendigerweise dein datenmodell zur designtime typisieren. Du kannst genuso gut auch mit generischen datenreferencen arbetien und zur laufzeit auf basis diene programmlogik iene typisierung vornehmen. Das ist zum Beispiel bei tabellen interessant um je nach user eingabe unterschiedliche spaleten anzuzeigen.
6+
7+
abap2UI5 serializes your app instances to ensure stateless behavior in client communication. Unfortunately, the sap standard transformation features are limited, for example not supporting local types created at runtime. Fortunately the project S-RTTI fills this gap.
8+
9+
10+
#### Normal
11+
12+
```abap
13+
CLASS z2ui5_cl_app DEFINITION PUBLIC.
14+
15+
PUBLIC SECTION.
16+
17+
INTERFACES z2ui5_if_app.
18+
19+
TYPES:
20+
BEGIN OF ty_row,
21+
title TYPE string,
22+
value TYPE string,
23+
descr TYPE string,
24+
END OF ty_row.
25+
DATA mt_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY.
26+
27+
ENDCLASS.
28+
29+
CLASS z2ui5_cl_app IMPLEMENTATION.
30+
31+
METHOD z2ui5_if_app~main.
32+
33+
mt_tab = VALUE #(
34+
( title = 'entry 01' value = 'red' descr = 'this is a description' )
35+
( title = 'entry 02' value = 'blue' descr = 'this is a description' )
36+
( title = 'entry 02' value = 'gray' descr = 'this is a description' ) ).
37+
38+
client->message_box_display( `this works without problems` ).
39+
40+
ENDMETHOD.
41+
ENDCLASS.
42+
```
43+
44+
#### Generic Data Reference (local type)
45+
```abap
46+
CLASS z2ui5_cl_app DEFINITION PUBLIC.
47+
48+
PUBLIC SECTION.
49+
50+
INTERFACES z2ui5_if_app.
51+
DATA mr_tab TYPE REF TO data.
52+
53+
ENDCLASS.
54+
55+
CLASS z2ui5_cl_app IMPLEMENTATION.
56+
57+
METHOD z2ui5_if_app~main.
58+
59+
TYPES:
60+
BEGIN OF ty_row,
61+
title TYPE string,
62+
value TYPE string,
63+
descr TYPE string,
64+
END OF ty_row.
65+
TYPES ty_t_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY.
66+
67+
CREATE DATA mr_tab TYPE ty_T_tab.
68+
69+
FIELD-SYMBOLS <tab> TYPE ty_T_tab.
70+
ASSIGN mr_tab->* TO <tab>.
71+
<tab> = VALUE #(
72+
( title = 'entry 01' value = 'red' descr = 'this is a description' )
73+
( title = 'entry 02' value = 'blue' descr = 'this is a description' )
74+
( title = 'entry 02' value = 'gray' descr = 'this is a description' ) ).
75+
76+
client->message_box_display( `this works only with S-RTTI` ).
77+
78+
ENDMETHOD.
79+
ENDCLASS.
80+
```

0 commit comments

Comments
 (0)