Cheat Sheet
Two tables on one page. The first answers "which call do I need", the second lists the rules that decide whether an app works. Every row links to the page that explains it in full.
I Want To…
| I want to… | Write | More |
|---|---|---|
| show the screen | client->view_display( view->stringify( ) ) | Building a View |
| show a value | )->tag( `Text` )->a( n = `text` v = client->_bind( name ) ) | Binding |
| let the user edit a value | )->tag( `Input` )->a( n = `value` v = client->_bind( name ) ) — the same _bind( ), what the user typed is in name on the next roundtrip | Binding |
| react to a button | )->a( n = `press` v = client->_event( `SAVE` ) ), then ELSEIF client->check_on_event( `SAVE` ). | Handling Events in ABAP |
| send a value with the event | client->_event( val = `SHOW` arg = `${PRODUCT}` ), then client->get_event_arg( ) | Handling Events in ABAP |
| show a short message | client->message_toast_display( `saved` ) | Message |
| show a message the user must close | client->message_box_display( text = `not found` type = `error` ) | Message |
| open a popup | client->popup_display( popup->stringify( ) ) | Popup |
| close the popup | client->popup_destroy( ) | Popup |
| start another app | client->nav_app_call( NEW zcl_other_app( ) ) | Navigating Between Apps |
| go back to the calling app | client->nav_app_leave( ) | Navigating Between Apps |
| read what the sub-app left | CAST zcl_other_app( client->get_app_prev( ) ) | Navigating Between Apps |
| set the focus | client->follow_up_action( val = client->cs_event-set_focus t_arg = VALUE #( ( `id_input` ) ) ) | Focus |
run main again after a delay | client->follow_up_action( val = client->cs_event-start_timer t_arg = VALUE #( ( `TICK` ) ( `2000` ) ) ) | Timer |
| copy a text to the clipboard | client->follow_up_action( val = client->cs_event-clipboard_copy t_arg = VALUE #( ( mv_text ) ) ) | Clipboard |
| open a URL in a new tab | client->follow_up_action( val = client->cs_event-open_new_tab t_arg = VALUE #( ( mv_url ) ) ) | URL Handling |
| show more than 100 table rows | client->follow_up_action( val = client->cs_event-set_size_limit t_arg = VALUE #( ( `1000` ) ( client->cs_view-main ) ) ) | More than 100 Rows |
| send a file to the browser | client->follow_up_action( val = client->cs_event-download_b64_file t_arg = VALUE #( ( mv_data_url ) ( mv_file_name ) ) ) | Upload, Download |
The value of an attribute goes into one of three parameters of a( ):
| Parameter | Use it for | Example |
|---|---|---|
v | a binding, an event, constant text | )->a( n = `text` v = `Save` ) |
b | an ABAP boolean | )->a( n = `enabled` b = mv_edit_mode ) |
t | text that comes from data | )->a( n = `title` t = ms_order-customer ) |
Golden Rules
| Rule | Why it matters |
|---|---|
Implement z2ui5_if_app and put everything in the single main method | It is the only entry point the framework calls — on the initial load and on every user interaction → App Structure |
Dispatch with one IF / ELSEIF chain over check_on_init( ), check_on_navigated( ) and check_on_event( ) | check_on_init( ) implies check_on_navigated( ), so init goes first; separate IF blocks let two branches run in the same roundtrip → App Structure |
Always call view_display( ) in the check_on_navigated( ) branch | After a sub-app returns via nav_app_leave( ), the browser still shows its view — without a re-display the user is left on a stale or blank screen → Navigation |
Declare every attribute you bind in the PUBLIC SECTION | Binding works via dynamic ASSIGN and cannot reach PROTECTED / PRIVATE; the roundtrip fails with BINDING_ERROR → Binding |
| Keep state in attributes, not in local variables | Between two events the app instance is serialized into the app draft on the SERVER and read back — attributes survive at any visibility; locals, DATA(...) declarations, open cursors and locks do not → Statefulness |
| Respect the UI5 aggregation rules even though the builder does not enforce them | The builder lets you nest anything inside anything; UI5 does not, and the mismatch surfaces as broken rendering rather than a syntax error → Building a View |
| Never use a deprecated UI5 control | It renders today and vanishes on the next UI5 upgrade — and the XML is passed through unchanged, so nothing in the framework stops you → linter, which reports it against the release your system runs |
| Take a ready-made dialog from the popups add-on before building your own | Confirm, select, file up/download, ranges, PDF and about a dozen more, versioned on their own → popups add-on |
Use backtick string literals (`) | Project-wide convention in the framework, the samples and this documentation; keeps ABAP string handling consistent |
An ABAP flag passed as v does not reach the view as a boolean
a( ) takes either v — any string expression — or b, an ABAP boolean. Only b converts, and it is the form to use whenever the value comes out of ABAP:
)->tag( `Button`
)->a( n = `text` v = `Save`
)->a( n = `enabled` b = abap_false ) " → enabled="false"Through v a bare flag does not compile, because v is a string and a c field is not type-compatible with it. A flag-valued expression such as xsdbool( … ) does compile and is written as it is: abap_true arrives in the view as enabled="X" and abap_false as an empty value. But X is not the true UI5 expects. There is no syntax error: the view renders, and on 1.71 the control is disabled.
A literal is a string and belongs in v, unquoted by any flag variable:
)->a( n = `enabled` v = `false` )Any expression that yields a flag works in b, so there is no reason to convert by hand: )->a( n = `visible` b = xsdbool( lines( mt_item ) > 0 ) ).
Next Steps
- Common Failures — symptoms and their usual causes
