Show TOC

Creating a New BSP Extension with ElementsLocate this document in the navigation structure

Procedure

To create the new BSP extension for the Solution that is described, first define the extension itself and then the elements that it contains. At the end, activate the extension.

  1. Create a new BSP extension in the ABAP Workbench (see also Creating BSP Extensions).

    In our example, this is called BSP_TUTORIAL_COMPLEX.

  2. Specify a Default Prefix.

    The default prefix is used for this BSP extension if you use drag & drop to add elements of this extension in the page with flow logic, or if you want to insert them in the view without having used this extension previously. If you use the BSP extension, you can change the default prefix at any time by renaming the prefix attribute of the extension directive. In our example, this is TutCmplx.

  3. In your new extension, create element <SimpleForm> (see also Defining BSP Elements).

    Recommendation

    We recommend that you integrate the default BSP extension prefix with the name of the element handler class.

    In our example, the name of the element handler class is CL_BSP_TUTCMPLX_SIMPLE_FORM.

  4. Define and configure the BSP element as usual.

    In our example, the element content consists exclusively of inner BSP elements and therefore does not have any freely-defined text.

    In our example, the element has an (obligatory) attribute called id of type string.

  5. Create new BSP element <SimpleFormItem>.

    This element displays an element that wraps both <htmlb:label> and <htmlb:inputField>. Since the <htmlb:inputField> element contains most of the attributes that you require for the new <TutCmplx:SimpleFormItem> element, you can simply copy the <htmlb:inputField> element.

    • To do this, branch to the BSP extension HTMLB for element <inputField> and on the selected element in the context menu choose Copy....

    • Then enter as the destination the BSP extension BSP_TUTORIAL_COMPLEX and SimpleFormItem as the destination BSP element.

      Since the copy function only copies the logical definition of the element, you must make a few additional changes. The new definition in particular is still linked to the original implementation class (element handler class).

    • Use the tabstrip Properties to change the connection to the element handler class and enter CL_BSP_TUTCMPLX_SIMPLE_FORM_IT.

    • Add the additional attributes that you require for processing <htmlb:label>. In this simple example, you only need one new attribute, which is the label name. On the tabstrip Attributes, enter the additional attribute label of type string.

  6. Save the BSP extension and generate it.

Result

At this point, the empty implementations for the elements were already generated.

You can now create a simple Test Page (although this does not create any output).