Skip to content

Commit b89b5e5

Browse files
authored
Update srtti.md
1 parent 2c183c8 commit b89b5e5

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

docs/advanced/technical/srtti.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
22
outline: [2, 4]
33
---
4-
# RTTI
4+
# S-RTTI
55

6-
<i class="fa-brands fa-github"></i> [S-RTTI Project on GitHub](https://github.com/sandraros/S-RTTI)
6+
In abap2UI5, you don’t necessarily need to define your data model at design time. Instead, you can work with generic data references and apply typing dynamically at runtime based on your program logic. This is particularly useful for scenarios like tables, where different columns and table types may be displayed depending on user input.
77

8-
In abap2UI5, you don’t necessarily need to type your data model at design time, just work with generic data references and apply typing at runtime based on your program logic. This is for example useful for tables where, depending on user input, you may want to display different columns.<br>
8+
abap2UI5 serializes app instances to ensure stateless behavior in client communication. However, SAP’s standard transformation features are limited and do not support data references with local types created at runtime. To overcome this limitation, the project [S-RTTI](https://github.com/sandraros/S-RTTI) is integrated into abap2UI5 under the `z2ui5` namespace.
99

10-
abap2UI5 serializes your app instances to ensure stateless behavior in client communication. The SAP standard serialization features are limited; they do not support data references with local types created at runtime. If you encounter problems, just install the fantastic project [S-RTTI](https://github.com/sandraros/S-RTTI) filling this gap.
1110

12-
#### Basic
13-
Fully typed data at design time, it works out of the box:
11+
#### Standard Transformation
12+
With fully typed data at design time, the standard SAP transformation works out of the box:
1413

1514
```abap
1615
CLASS z2ui5_cl_app DEFINITION PUBLIC.
@@ -47,8 +46,8 @@ CLASS z2ui5_cl_app IMPLEMENTATION.
4746
ENDCLASS.
4847
```
4948

50-
#### Generic Data Reference (local type)
51-
Data typed at runtime with local types; this only works with S-RTTI:
49+
#### Transformation with S-RTTI
50+
When working with data typed dynamically at runtime using local types, S-RTTI is required:
5251
```abap
5352
CLASS z2ui5_cl_app DEFINITION PUBLIC.
5453
@@ -82,3 +81,11 @@ CLASS z2ui5_cl_app IMPLEMENTATION.
8281
ENDCLASS.
8382
8483
```
84+
#### Functionality
85+
With generic types, the standard transformation throws an error. abap2UI5 resolves this issue by looping over all attributes and applying a workaround:
86+
- For each generic attribute, a separate serialization is performed using S-RTTI beforehand.
87+
- The data is stored in a separate table.
88+
- The variable is initialized, and the standard SAP transformation is called again.
89+
- On the way back, the object is recreated, and the table content is deserialized back into the attributes.
90+
-
91+
This approach ensures compatibility with dynamic types while maintaining a robust transformation process. This process works in the background and independently of the two app implementations above.

0 commit comments

Comments
 (0)