abap2UI5

Wizard standard use case

The Wizard is useful for breaking down complex tasks into smaller steps.

Z2UI5_CL_SMPC_APP_101

Controls sap.m UI5 1.71

The facts

Repository
abap2UI5/samples-controls
Class
Z2UI5_CL_SMPC_APP_101
Source file
z2ui5_cl_smpc_app_101.clas.abap ↗
Library
sap.m
UI5 entity
sap.m.Wizard
Demo kit sample
sap.m.sample.Wizard
SAP's own sample
running at sdk.openui5.org ↗
Minimum UI5
1.71 — the floor abap2UI5 holds its samples to
In the playground
runs in the browser, with no system and nothing installed

Keywords: wizard, sap.m, multi-step, product, creation, navcontainer, wizardstep, messagestrip, text, hbox, segmentedbutton, segmentedbuttonitem

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_101.clas.abap — 587 lines Read it on GitHub ↗
" @keywords wizard sap.m multi-step product creation navcontainer wizardstep messagestrip text hbox segmentedbutton segmentedbuttonitem
" @summary The Wizard is useful for breaking down complex tasks into smaller steps.
" @origin sap.m.sample.Wizard - https://sdk.openui5.org/entity/sap.m.Wizard/sample/sap.m.sample.Wizard (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_101 DEFINITION PUBLIC.

  PUBLIC SECTION.
    INTERFACES z2ui5_if_app.

    DATA producttype TYPE string.
    DATA productname TYPE string.
    DATA productnamestate TYPE string.
    DATA productweight TYPE string.
    DATA productweightstate TYPE string.
    DATA productmanufacturer TYPE string.
    DATA productdescription TYPE string.
    DATA manufacturingdate TYPE string.
    DATA availabilitytype TYPE string.
    DATA size TYPE string.
    DATA measurement TYPE string.
    DATA productprice TYPE string.
    DATA discountgroup TYPE string.
    DATA productvat TYPE abap_bool.
    DATA step2_validated TYPE abap_bool.

  PROTECTED SECTION.
    DATA client TYPE REF TO z2ui5_if_client.

    METHODS view_display.
    METHODS on_event.
    METHODS edit_step IMPORTING step_id TYPE string.
    METHODS model_init.

  PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_smpc_app_101 IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    me->client = client.
    IF client->check_on_init( ).
      model_init( ).
      view_display( ).
    ELSEIF client->check_on_navigated( ).
      view_display( ).
    ELSEIF client->check_on_event( ).
      on_event( ).
    ENDIF.

  ENDMETHOD.


  METHOD view_display.

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

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

        )->ele( `NavContainer`
            )->a( n = `id` v = `wizardNavContainer`

            )->ele( `pages`
                )->ele( `Page`
                    )->a( n = `id`         v = `wizardContentPage`
                    )->a( n = `showHeader` v = `false`

                    )->ele( `content`
                        )->ele( `Wizard`
                            )->a( n = `id`       v = `CreateProductWizard`
                            )->a( n = `class`    v = `sapUiResponsivePadding--header sapUiResponsivePadding--content`
                            )->a( n = `complete` v = client->_event( `WIZARD_COMPLETE` )

                            )->ele( `WizardStep`
                                )->a( n = `id`        v = `ProductTypeStep`
                                )->a( n = `title`     v = `Product Type`
                                )->a( n = `validated` v = `true`

                                )->tag( `MessageStrip`
                                    )->a( n = `class`    v = `sapUiSmallMarginBottom`
                                    )->a( n = `text`     v = `The Wizard control is supposed to break down large tasks, into smaller steps, easier for the user to work with.`
                                    )->a( n = `showIcon` v = `true`
                                )->tag( `Text`
                                    )->a( n = `class` v = `sapUiSmallMarginBottom`
                                    )->a( n = `text`  v = `Sed fermentum, mi et tristique ullamcorper, sapien sapien faucibus sem, quis pretium nibh lorem malesuada diam. ` &&
                                                          `Nulla quis arcu aliquet, feugiat massa semper, volutpat diam. Nam vitae ante posuere, molestie neque sit amet, dapibus velit. ` &&
                                                          `Maecenas eleifend tempor lorem. Mauris vitae elementum mi, sed eleifend ligula. Nulla tempor vulputate dolor, nec dignissim quam convallis ut. ` &&
                                                          `Praesent vitae commodo felis, ut iaculis felis. Fusce quis eleifend sapien, eget facilisis nibh. Suspendisse est velit, scelerisque ut commodo eget, dignissim quis metus. ` &&
                                                          `Cras faucibus consequat gravida. Curabitur vitae quam felis. Phasellus ac leo eleifend, commodo tortor et, varius quam. Aliquam erat volutpat`

                                )->ele( `HBox`
                                    )->a( n = `alignItems`     v = `Center`
                                    )->a( n = `justifyContent` v = `Center`
                                    )->a( n = `width`          v = `100%`

                                    )->ele( `SegmentedButton`
                                        )->a( n = `width`           v = `320px`
                                        )->a( n = `selectedKey`     v = client->_bind( producttype )
                                        )->a( n = `selectionChange` v = client->_event( `SET_PRODUCT_TYPE` )

                                        )->ele( `items`
                                            )->tag( `SegmentedButtonItem`
                                                )->a( n = `icon` v = `sap-icon://iphone`
                                                )->a( n = `text` v = `Mobile`
                                                )->a( n = `key`  v = `Mobile`
                                            )->tag( `SegmentedButtonItem`
                                                )->a( n = `icon` v = `sap-icon://sys-monitor`
                                                )->a( n = `text` v = `Desktop`
                                                )->a( n = `key`  v = `Desktop`
                                            )->tag( `SegmentedButtonItem`
                                                )->a( n = `icon` v = `sap-icon://database`
                                                )->a( n = `text` v = `Other`
                                                )->a( n = `key`  v = `Other`

                                        )->end(
                                    )->end(
                                )->end(
                            )->end(

                            )->ele( `WizardStep`
                                )->a( n = `id`        v = `ProductInfoStep`
                                )->a( n = `validated` v = client->_bind( step2_validated )
                                )->a( n = `title`     v = `Product Information`
                                )->a( n = `activate`  v = client->_event( `ADDITIONAL_INFO` )

                                )->tag( `MessageStrip`
                                    )->a( n = `class`    v = `sapUiSmallMarginBottom`
                                    )->a( n = `text`     v = `Validation in the wizard is controlled by calling the validateStep(Step) and invalidateStep(Step) methods `
                                    )->a( n = `showIcon` v = `true`
                                )->tag( `Text`
                                    )->a( n = `text` v = `Cras tellus leo, volutpat vitae ullamcorper eu, posuere malesuada nisl. Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in ` &&
                                                         `libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien et viverra imperdiet, orci erat porttitor nulla, eget ` &&
                                                         `commodo metus nibh nec ipsum. Aliquam lacinia euismod metus, sollicitudin pellentesque purus volutpat eget. Pellentesque egestas erat quis eros convallis ` &&
                                                         `mattis. Mauris hendrerit sapien a malesu corper eu, posuere malesuada nisl. Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam ` &&
                                                         `in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien corper eu, posuere malesuada nisl. Integer ` &&
                                                         `pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. ` &&
                                                         `Donec pulvinar, sapien `

                                )->ele( n = `SimpleForm` ns = `form`
                                    )->a( n = `editable` v = `true`
                                    )->a( n = `layout`   v = `ResponsiveGridLayout`

                                    )->tag( `Label`
                                        )->a( n = `text`     v = `Name`
                                        )->a( n = `required` v = `true`
                                    )->tag( `Input`
                                        )->a( n = `valueStateText` v = `Enter 6 symbols or more`
                                        )->a( n = `valueState`     v = client->_bind( productnamestate )
                                        )->a( n = `id`             v = `ProductName`
                                        )->a( n = `liveChange`     v = client->_event( val = `ADDITIONAL_INFO` s_ctrl = VALUE #( check_queue_last = abap_true check_no_busy = abap_true ) )
                                        )->a( n = `placeholder`    v = `Enter name with length greater than 6`
                                        )->a( n = `value`          v = client->_bind( productname )
                                        )->a( n = `valueLiveUpdate` v = `true`
                                    )->tag( `Label`
                                        )->a( n = `text`     v = `Weight`
                                        )->a( n = `required` v = `true`
                                    )->tag( `Input`
                                        )->a( n = `valueStateText` v = `Enter digits`
                                        )->a( n = `valueState`     v = client->_bind( productweightstate )
                                        )->a( n = `id`             v = `ProductWeight`
                                        )->a( n = `liveChange`     v = client->_event( val = `ADDITIONAL_INFO` s_ctrl = VALUE #( check_queue_last = abap_true check_no_busy = abap_true ) )
                                        )->a( n = `type`           v = `Number`
                                        )->a( n = `placeholder`    v = `Enter digits`
                                        )->a( n = `value`          v = client->_bind( productweight )
                                        )->a( n = `valueLiveUpdate` v = `true`
                                    )->tag( `Label`
                                        )->a( n = `text` v = `Manufacturer`

                                    )->ele( `Select`
                                        )->a( n = `selectedKey` v = client->_bind( productmanufacturer )

                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Apple`
                                            )->a( n = `text` v = `Apple`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Microsoft`
                                            )->a( n = `text` v = `Microsoft`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Google`
                                            )->a( n = `text` v = `Google`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Sony`
                                            )->a( n = `text` v = `Sony`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Samsung`
                                            )->a( n = `text` v = `Samsung`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Logitech`
                                            )->a( n = `text` v = `Logitech`

                                    )->end(
                                    )->tag( `Label`
                                        )->a( n = `text` v = `Description`
                                    )->tag( `TextArea`
                                        )->a( n = `value` v = client->_bind( productdescription )
                                        )->a( n = `rows`  v = `8`

                                )->end(
                            )->end(

                            )->ele( `WizardStep`
                                )->a( n = `id`        v = `OptionalInfoStep`
                                )->a( n = `validated` v = `true`
                                )->a( n = `activate`  v = client->_event( `OPTIONAL_ACTIVATE` )
                                )->a( n = `title`     v = `Optional Information`

                                )->tag( `MessageStrip`
                                    )->a( n = `class`    v = `sapUiSmallMarginBottom`
                                    )->a( n = `text`     v = `You can validate steps by default with the validated='true' property of the step. The next button is always enabled.`
                                    )->a( n = `showIcon` v = `true`
                                )->tag( `Text`
                                    )->a( n = `text` v = `Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet ` &&
                                                         `dui. Donec ppellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in libero sem. Suspendisse arcu metus, molestie a turpis a, molestie ` &&
                                                         `aliquet dui. Donec pulvinar, sapien corper eu, posuere malesuada nisl. Integer pellentesque leo sit amet dui vehicula, quis ullamcorper est pulvinar. Nam in ` &&
                                                         `libero sem. Suspendisse arcu metus, molestie a turpis a, molestie aliquet dui. Donec pulvinar, sapien `

                                )->ele( n = `SimpleForm` ns = `form`
                                    )->a( n = `editable` v = `true`
                                    )->a( n = `layout`   v = `ResponsiveGridLayout`

                                    )->tag( `Label`
                                        )->a( n = `text` v = `Cover photo`
                                    )->tag( n = `FileUploader` ns = `u`
                                        )->a( n = `width`       v = `100%`
                                        )->a( n = `tooltip`     v = `Upload product cover photo to the local server`
                                        )->a( n = `style`       v = `Emphasized`
                                        )->a( n = `placeholder` v = `Choose a file for Upload...`
                                    )->tag( `Label`
                                        )->a( n = `text` v = `Manufacturing date`
                                    )->tag( `DatePicker`
                                        )->a( n = `id`            v = `DP3`
                                        )->a( n = `displayFormat` v = `short`
                                        )->a( n = `value`         v = client->_bind( manufacturingdate )
                                    )->tag( `Label`
                                        )->a( n = `text` v = `Availability`

                                    )->ele( `SegmentedButton`
                                        )->a( n = `selectedKey` v = client->_bind( availabilitytype )

                                        )->ele( `items`
                                            )->tag( `SegmentedButtonItem`
                                                )->a( n = `key`  v = `In store`
                                                )->a( n = `text` v = `In store`
                                            )->tag( `SegmentedButtonItem`
                                                )->a( n = `key`  v = `In depot`
                                                )->a( n = `text` v = `In depot`
                                            )->tag( `SegmentedButtonItem`
                                                )->a( n = `key`  v = `In repository`
                                                )->a( n = `text` v = `In repository`
                                            )->tag( `SegmentedButtonItem`
                                                )->a( n = `key`  v = `Out of stock`
                                                )->a( n = `text` v = `Out of stock`

                                        )->end(
                                    )->end(
                                    )->tag( `Label`
                                        )->a( n = `text` v = `Size`
                                    )->tag( `Input`
                                        )->a( n = `value` v = client->_bind( size )

                                    )->ele( `ComboBox`
                                        )->a( n = `maxWidth`    v = `100px`
                                        )->a( n = `selectedKey` v = client->_bind( measurement )

                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `X`
                                            )->a( n = `text` v = `X`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Y`
                                            )->a( n = `text` v = `Y`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Z`
                                            )->a( n = `text` v = `Z`

                                    )->end(
                                )->end(
                            )->end(

                            )->ele( `WizardStep`
                                )->a( n = `id`        v = `PricingStep`
                                )->a( n = `activate`  v = client->_event( `PRICING_ACTIVATE` )
                                )->a( n = `complete`  v = client->_event( `PRICING_COMPLETE` )
                                )->a( n = `validated` v = `true`
                                )->a( n = `title`     v = `Pricing`

                                )->tag( `MessageStrip`
                                    )->a( n = `class`    v = `sapUiSmallMarginBottom`
                                    )->a( n = `text`     v = `You can use the wizard previousStep() and nextStep() methods to navigate from step to step without validation. ` &&
                                                             `Also you can use the GoToStep(step) method to scroll programmatically to previously visited steps.`
                                    )->a( n = `showIcon` v = `true`

                                )->ele( n = `SimpleForm` ns = `form`
                                    )->a( n = `editable` v = `true`
                                    )->a( n = `layout`   v = `ResponsiveGridLayout`

                                    )->tag( `Label`
                                        )->a( n = `text` v = `Price`
                                    )->tag( `Input`
                                        )->a( n = `value` v = client->_bind( productprice )
                                    )->tag( `Label`
                                        )->a( n = `text` v = `Discount group`

                                    )->ele( `ComboBox`
                                        )->a( n = `selectedKey` v = client->_bind( discountgroup )

                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Kids`
                                            )->a( n = `text` v = `Kids`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Teens`
                                            )->a( n = `text` v = `Teens`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Adults`
                                            )->a( n = `text` v = `Adults`
                                        )->tag( n = `Item` ns = `core`
                                            )->a( n = `key`  v = `Elderly`
                                            )->a( n = `text` v = `Elderly`

                                    )->end(
                                    )->tag( `Label`
                                        )->a( n = `text` v = ` VAT is included`
                                    )->tag( `CheckBox`
                                        )->a( n = `selected` v = client->_bind( productvat )

                                )->end(
                            )->end(
                        )->end(
                    )->end(
                    )->ele( `footer`
                        )->ele( `OverflowToolbar`
                            )->tag( `ToolbarSpacer`
                            )->tag( `Button`
                                )->a( n = `text`  v = `Cancel`
                                )->a( n = `press` v = client->_event( `WIZARD_CANCEL` )

                        )->end(
                    )->end(
                )->end(
                )->ele( `Page`
                    )->a( n = `id`         v = `wizardReviewPage`
                    )->a( n = `showHeader` v = `false`

                    )->ele( `content`
                        )->ele( n = `SimpleForm` ns = `form`
                            )->a( n = `title`    v = `1. Product Type`
                            )->a( n = `editable` v = `false`
                            )->a( n = `layout`   v = `ResponsiveGridLayout`

                            )->ele( n = `content` ns = `form`
                                )->tag( `Label`
                                    )->a( n = `text` v = `Type`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ProductTypeChosen`
                                    )->a( n = `text` v = client->_bind( producttype )
                                )->tag( `Link`
                                    )->a( n = `press` v = client->_event( `EDIT_STEP_1` )
                                    )->a( n = `text`  v = `Edit`

                            )->end(
                        )->end(
                        )->ele( n = `SimpleForm` ns = `form`
                            )->a( n = `title`    v = `2. Product Information`
                            )->a( n = `editable` v = `false`
                            )->a( n = `layout`   v = `ResponsiveGridLayout`

                            )->ele( n = `content` ns = `form`
                                )->tag( `Label`
                                    )->a( n = `text` v = `Name`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ProductNameChosen`
                                    )->a( n = `text` v = client->_bind( productname )
                                )->tag( `Label`
                                    )->a( n = `text` v = `Weight`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ProductWeightChosen`
                                    )->a( n = `text` v = client->_bind( productweight )
                                )->tag( `Label`
                                    )->a( n = `text` v = `Manufacturer`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ProductManufacturerChosen`
                                    )->a( n = `text` v = client->_bind( productmanufacturer )
                                )->tag( `Label`
                                    )->a( n = `text` v = `Description`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ProductDescriptionChosen`
                                    )->a( n = `text` v = client->_bind( productdescription )
                                )->tag( `Link`
                                    )->a( n = `press` v = client->_event( `EDIT_STEP_2` )
                                    )->a( n = `text`  v = `Edit`

                            )->end(
                        )->end(
                        )->ele( n = `SimpleForm` ns = `form`
                            )->a( n = `title`    v = `3. Optional Information`
                            )->a( n = `editable` v = `false`
                            )->a( n = `layout`   v = `ResponsiveGridLayout`

                            )->ele( n = `content` ns = `form`
                                )->tag( `Label`
                                    )->a( n = `text` v = `Some text`
                                )->tag( `Text`
                                    )->a( n = `text` v = `Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. `

                                )->tag( `Label`
                                    )->a( n = `text` v = `Manufacturing Date`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ManufacturingDate`
                                    )->a( n = `text` v = client->_bind( manufacturingdate )
                                )->tag( `Label`
                                    )->a( n = `text` v = `Availability`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `AvailabilityChosen`
                                    )->a( n = `text` v = client->_bind( availabilitytype )
                                )->tag( `Label`
                                    )->a( n = `text` v = `Size`

                                )->ele( `HBox`
                                    )->tag( `Text`
                                        )->a( n = `id`   v = `Size`
                                        )->a( n = `text` v = client->_bind( size )
                                    )->tag( `Text`
                                        )->a( n = `id`    v = `Size2`
                                        )->a( n = `class` v = `sapUiTinyMarginBegin`
                                        )->a( n = `text`  v = client->_bind( measurement )

                                )->end(
                                )->tag( `Link`
                                    )->a( n = `press` v = client->_event( `EDIT_STEP_3` )
                                    )->a( n = `text`  v = `Edit`

                            )->end(
                        )->end(
                        )->ele( n = `SimpleForm` ns = `form`
                            )->a( n = `title`    v = `4. Pricing`
                            )->a( n = `editable` v = `false`
                            )->a( n = `layout`   v = `ResponsiveGridLayout`

                            )->ele( n = `content` ns = `form`
                                )->tag( `Label`
                                    )->a( n = `text` v = `Price`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ProductPriceChosen`
                                    )->a( n = `text` v = client->_bind( productprice )
                                )->tag( `Label`
                                    )->a( n = `text` v = `Discount Group`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `DiscountGroupChosen`
                                    )->a( n = `text` v = client->_bind( discountgroup )
                                )->tag( `Label`
                                    )->a( n = `text` v = `VAT Included`
                                )->tag( `Text`
                                    )->a( n = `id`   v = `ProductVATChosen`
                                    )->a( n = `text` v = client->_bind( productvat )
                                )->tag( `Link`
                                    )->a( n = `press` v = client->_event( `EDIT_STEP_4` )
                                    )->a( n = `text`  v = `Edit`

                            )->end(
                        )->end(
                    )->end(
                    )->ele( `footer`
                        )->ele( `Bar`
                            )->ele( `contentRight`
                                )->tag( `Button`
                                    )->a( n = `text`  v = `Submit`
                                    )->a( n = `press` v = client->_event( `WIZARD_SUBMIT` )
                                )->tag( `Button`
                                    )->a( n = `text`  v = `Cancel`
                                    )->a( n = `press` v = client->_event( `WIZARD_CANCEL` )

                            )->end(
                        )->end(
                    )->end(
                )->end(
            )->end(
        )->end( ).

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

  ENDMETHOD.


  METHOD on_event.

    CASE client->get_event( ).

      WHEN `ADDITIONAL_INFO`.
        " reproduces additionalInfoValidation: name >= 6 chars, weight numeric
        DATA(name_ok) = xsdbool( strlen( productname ) >= 6 ).
        " the original tests parseInt( ) IS NaN, which is far laxer than "all
        " digits": leading blanks and a sign are skipped and parsing stops at
        " the first non-digit, so '12.5', '-5' and '12abc' are all VALID there
        DATA(weight) = condense( productweight ).
        IF weight IS NOT INITIAL AND ( weight(1) = `-` OR weight(1) = `+` ).
          weight = weight+1.
        ENDIF.
        DATA(weight_ok) = COND abap_bool( WHEN weight IS INITIAL THEN abap_false
                                          ELSE xsdbool( weight(1) CO `0123456789` ) ).
        productnamestate   = COND #( WHEN name_ok = abap_true THEN `None` ELSE `Error` ).
        productweightstate = COND #( WHEN weight_ok = abap_true THEN `None` ELSE `Error` ).
        step2_validated      = xsdbool( name_ok = abap_true AND weight_ok = abap_true ).
        IF step2_validated = abap_false.
          " both failing branches of the original also call
          " setCurrentStep( ProductInfoStep ), forcing the wizard back to it
          client->follow_up_action( val   = client->cs_event-control_by_id
                                    t_arg = VALUE #( ( `CreateProductWizard` ) ( `setCurrentStep` ) ( `ProductInfoStep` ) ) ).
        ENDIF.

      WHEN `OPTIONAL_ACTIVATE`.
        client->message_toast_display( `This event is fired on activate of Step3.` ).

      WHEN `WIZARD_COMPLETE`.
        client->follow_up_action( val   = client->cs_event-control_by_id
                                  t_arg = VALUE #( ( `wizardNavContainer` ) ( `to` ) ( `wizardReviewPage` ) ) ).

      WHEN `EDIT_STEP_1`.
        edit_step( `ProductTypeStep` ).

      WHEN `EDIT_STEP_2`.
        edit_step( `ProductInfoStep` ).

      WHEN `EDIT_STEP_3`.
        edit_step( `OptionalInfoStep` ).

      WHEN `EDIT_STEP_4`.
        edit_step( `PricingStep` ).

      WHEN `WIZARD_CANCEL`.
        client->message_box_display( text    = `Are you sure you want to cancel your report?`
                                     type    = `warning`
                                     actions = VALUE #( ( `YES` ) ( `NO` ) )
                                     onclose = `CANCEL_CLOSED` ).

      WHEN `WIZARD_SUBMIT`.
        client->message_box_display( text    = `Are you sure you want to submit your report?`
                                     type    = `confirm`
                                     actions = VALUE #( ( `YES` ) ( `NO` ) )
                                     onclose = `CANCEL_CLOSED` ).

      WHEN `CANCEL_CLOSED`.
        IF client->get_event_arg( ) = `YES`.
          client->follow_up_action( val   = client->cs_event-control_by_id
                                    t_arg = VALUE #( ( `wizardNavContainer` ) ( `backToPage` ) ( `wizardContentPage` ) ) ).
          client->follow_up_action( val   = client->cs_event-control_by_id
                                    t_arg = VALUE #( ( `CreateProductWizard` ) ( `discardProgress` ) ( `ProductTypeStep` ) ) ).
        ENDIF.

    ENDCASE.

  ENDMETHOD.


  METHOD edit_step.

    " original _handleNavigationToStep: back to the wizard content page, then goToStep
    client->follow_up_action( val   = client->cs_event-control_by_id
                              t_arg = VALUE #( ( `wizardNavContainer` ) ( `backToPage` ) ( `wizardContentPage` ) ) ).
    client->follow_up_action( val   = client->cs_event-control_by_id
                              t_arg = VALUE #( ( `CreateProductWizard` ) ( `goToStep` ) ( step_id ) ) ).

  ENDMETHOD.


  METHOD model_init.

    productnamestate   = `Error`.
    productweightstate = `Error`.
    producttype         = `Mobile`.
    availabilitytype    = `In Store`.
    productvat          = abap_false.
    measurement          = ``.
    productmanufacturer = `n/a`.
    productdescription  = `n/a`.
    size                 = `n/a`.
    productprice        = `n/a`.
    manufacturingdate   = `n/a`.
    discountgroup       = `n/a`.

  ENDMETHOD.

ENDCLASS.

More in sap.m

Search every abap2UI5 sample · the full list on one page

On this page