Creating Blocks

This guide outlines the most important points when creating blocks for the sap.uxap.Object.Page.Layout

Decide which kind of block to use:

  • Single view block if Collapsed, Expanded and Compact modes are similar and easy to develop with a single view.

  • Multiple view blocks if it’s easier to provide different views for the different modes.

  • Free form if none of these suit your needs.

Single View Block Creation

  • Create the block folder in the source control of the app.

  • Add a BlockName.js file which extends sap.uxap.BlockBase.
    Note Naming guideline: The block name should end with the word Block.
  • Add a BlockName.view.xml XML view.

  • If needed, add the associated controller: BlockNameController.controller.js.

Multiple View Block Creation

  • Create the block folder in the source control of the app.

  • Add a BlockName.js file which extends sap.uxap.BlockBase.

  • Declare the views to be used for the different modes in the views section of the metadata.

  • Add the Expanded and Collapsed XML views.
    Note Naming guideline: Call these files BlockNameCollapsed.view.xml, BlockNameExpanded.view.xml
  • If needed, add the associated controllers. Whether you use the same controller for all views or one controller per view is your decision.

Free Form Block Creation

  • Create the block folder in the source control of the app.

  • Add a BlockName.js file which extends sap.uxap.BlockBase.

  • Override the setMode method - from here on, all changes are up to you.