Skip to content

Share, Bookmark

The app state feature opens up several useful options — like sharing and bookmarking the current state of your app.

Share

Add a share button that copies the current state to the clipboard to share with colleagues:

abap
CLASS z2ui5_cl_sample_share DEFINITION PUBLIC.

  PUBLIC SECTION.
    INTERFACES z2ui5_if_app.
    DATA mv_quantity TYPE string.

ENDCLASS.

CLASS z2ui5_cl_sample_share IMPLEMENTATION.
  METHOD z2ui5_if_app~main.

    CASE abap_true.

      WHEN client->check_on_navigated( ).

        DATA(view) = z2ui5_cl_xml_view=>factory( )->shell( )->page(
          )->label( `quantity`
          )->input( client->_bind_edit( mv_quantity )
          )->button( text  = `share` press = client->_event( `BUTTON_POST` ) ).
        client->view_display( view->stringify( ) ).

      WHEN client->check_on_event( `BUTTON_POST` ).

        client->follow_up_action( client->_event_client( z2ui5_if_client=>cs_event-CLIPBOARD_APP_STATE ) ).
        client->message_toast_display( `clipboard copied` ).

    ENDCASE.
  ENDMETHOD.
ENDCLASS.

Bookmark

You can also use these URLs for bookmarking, but note that the server keeps the app state only for a limited time. The default is 4 hours. See the draft service source.