abap2UI5

Shell Bar with menu button

Shell Bar example with a menu button and a plain title.

Z2UI5_CL_SMPC_APP_152

Controls sap.f UI5 1.73

The facts

Repository
abap2UI5/samples-controls
Class
Z2UI5_CL_SMPC_APP_152
Source file
z2ui5_cl_smpc_app_152.clas.abap
Library
sap.f
UI5 entity
sap.f.ShellBar
Demo kit sample
sap.f.sample.ShellBarWithMenuButton
SAP's own sample
running at sdk.openui5.org ↗
Minimum UI5
1.73
In the playground
runs in the browser, with no system and nothing installed

Keywords: shellbar, shell, bar, sap.f, menu, button, avatar

Controls it builds

Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.

Libraries

Run it here

The sample running, in this page — the app on its own, with no editor over it. Switch to Playground with this code

Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.

The ABAP

z2ui5_cl_smpc_app_152.clas.abap — 63 lines Read it on GitHub ↗
" @keywords shellbar shell bar sap.f menu button avatar
" @summary Shell Bar example with a menu button and a plain title.
CLASS z2ui5_cl_smpc_app_152 DEFINITION PUBLIC.

  PUBLIC SECTION.
    INTERFACES z2ui5_if_app.

  PROTECTED SECTION.
    DATA client TYPE REF TO z2ui5_if_client.

    METHODS view_display.

  PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_smpc_app_152 IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    me->client = client.
    IF client->check_on_navigated( ).
      view_display( ).
    ENDIF.

  ENDMETHOD.


  METHOD view_display.

    DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).

    view->ele( n = `View` ns = `mvc`
        )->a( n = `xmlns:mvc`    v = `sap.ui.core.mvc`
        )->a( n = `xmlns`        v = `sap.f`
        )->a( n = `xmlns:m`      v = `sap.m`
        )->a( n = `xmlns:layout` v = `sap.ui.layout`
        )->a( n = `height`       v = `100%`

        )->ele( `ShellBar`
            )->a( n = `id`                  v = `sapFShellBarSample`
            )->a( n = `title`               v = `Application Title`
            )->a( n = `secondTitle`         v = `Short description`
            " homeIcon absolutized to the OpenUI5 host (original: ./resources/...)
            )->a( n = `homeIcon`            v = `https://sdk.openui5.org/resources/sap/ui/documentation/sdk/images/logo_sap.png`
            )->a( n = `showCopilot`         v = `true`
            )->a( n = `showSearch`          v = `true`
            )->a( n = `showMenuButton`      v = `true`
            )->a( n = `showNavButton`       v = `true`
            )->a( n = `showNotifications`   v = `true`
            )->a( n = `class`               v = `sapFShellBarFCLFPHeader`
            )->a( n = `notificationsNumber` v = `2`

            )->ele( `profile`
                " sap.m.Avatar is @since 1.73 - kept 1:1 (POST_171)
                )->tag( n = `Avatar` ns = `m`
                    )->a( n = `initials` v = `UI` ).

    client->view_display( view->stringify( ) ).

  ENDMETHOD.

ENDCLASS.

More in sap.f

Search every abap2UI5 sample · the full list on one page

On this page