Show TOC

Procedure documentationTutorial part 5: Create BAdI implementation Locate this document in the navigation structure

 

This tutorial is part of a course that explains the creation and registration of apps for the Dashboard Framework. In this step, you create a simple BW implemention to provide values to an app. The implementation passes additional information about the subsidiaries of a fictional company, in a table that is forwarded to the app via an Xcelsius connection, and displayed in the app.

Prerequisites

This procedure is part of a comprehensive tutorial about Creating and Registering Dashboard Apps. During this tutorial, you create and register apps and their data sources.

You create this BAdI implementation in the fifth part of the tutorial, where you also learn another way to get data.

Note Note

You should already have worked through the previous step, as described in Tutorial part 5: Create App with Data Provided by BAdI.

End of the note.

Procedure

Create the BAdI implementation as follows:

Create Implementation

In this section, you specify the technical name, short text and object catalog entry of the enhancement and its BAdI implementation. Proceed as follows:

  1. Start the Object Navigator in transaction SE80.

  2. Go to the package AI_DSH_CORE. This package contains the enhancement spot DFWK_DS_BADI_DATA, in which you create the enhancement implementation.

    Expand the navigation path along   AI_DSH_CORE   Enhancements   Enhancement Spot   IF_DFWK_DS_BADI_DATA  , and select this enhancement spot.

  3. Go to the Enh. Spot Element Definition at the right-hand side of the enhancement spot. Create a new implementation by choosing, in the context menu of the BAdI defintion DFWK_DS_BADI_DATA, the entry Create BAdI Implementation.

  4. A new screen lists the existing implementations of the enhancement spot. Choose Create Enhancement Implementation (Create Enhancement Implementation). Enter the following data for your implementation:

    • In the input field Enhancement Implementation, enter the technical name Z_TUTORIAL5_DATA_SUPPLIER.

    • In the input field Short Text, enter the description Data Provider for Dashboard - Tutorial.

    • Leave the Compound Enhancement Implementation field empty.

  5. Create the enhancement by choosing Continue (Continue) and confirming that the object is in customer namespace.

  6. Enter the required information in the Create Object Catalog Entry screen, depending on whether you want to transport the implementation. In this tutorial, you do not transport the object, so choose Local Object, and confirm that the enhancement implementation was created in a package which is not assigned to a switch.

  7. Select the enhancement in the list, and choose Create Enhancement Implementation (Create Enhancement Implementation).

  8. You go to a screen in which you create BAdI Implementation. Enter the following data:

    • In the input field BAdI Implementation, enter the technical name Z_TUTORIAL5_DATA_SUPPLIER.

    • In the input field Short Text, enter the description Data Provider for Dashboard - Tutorial.

    • In the input field Implementing Class, enter the class name Z_TUTORIAL_IMPL_CLASS.

    Note Note

    Create two objects, because the Enhancement Implementation is a container for the BAdI Implementation. Because there is one object in this container for this tutorial, you have assigned the same name. For more information, see Implementing BAdIs.

    End of the note.
  9. Create the implementation by choosing Continue (Continue) and confirming that the object is in customer namespace.

  10. In the Create Object Catalog Entry screen, choose Local Object.

Create Filter Value

In the previous section, you created the implementation. Now specify a filter value for the implementation. This filter value connects the app and the BAdI implementation when you register the app in the next step of the tutorial (see Tutorial part 5: Register App), by specifying the filter value which you specify here in the implementation, when you register the app.

To specify the filter value with which this BAdI implementation is called, proceed as follows:

  1. In the Object Navigator, the system shows the enhancement implementtion Z_TUTORIAL5_DATA_SUPPLIER, which you created in the previous section. Choose the tab Enhancement Implementation Elements, at the right-hand side, and expand the BAdI Implementation Z_TUTORIAL5_DATA_SUPPLIER in the subscreen navigation bar.

  2. In the navigation bar, choose Filter Values, go to change mode with Display<->Change (Display<->Change), and choose Create Filter Combination (Create Filter Combination)

  3. The system has created a filter combination with the default name Combination 1. To set a filter value for this combination, in the table Filter Values, select the lower, indented row of the combination, and choose Change Filter Value (Change Filter Value).

  4. You go to the Change Filter Value screen. Enter the following data:

    • Enter the filter value in the input field Value 1. In this tutorial, this is TUTORIAL_FILTER.

    • In the drop-down box Comparison 1, choose =.

    Save the filter value with Continue (Continue).

Create Implementing Class Methods

The filter value specifies under which conditions an app will call the implementation. This section specifies which values the app is to display. It has the following two methods:

  • GET_CONTENT

    Use this method to use the BAdI as data source. Assign to each possible value of the method parameter i_name an Xcelsius connection (Incoming App Connectiong) with the attribute Is Write, in the registration tool.

  • SET_CONTENT

    Use this method to use the app as a data source for the BAdI (for example, a configuration app). Assign to each possible value of the method parameter i_name an Xcelsius connection (Outgoing App Connection) with the attribute Is Read.

In this tutorial, only use the method GET_CONTENT. For the tutorial, enter the values to be displayed, manually. If you want to develop your own BAdI implementations for your apps, you would probably determine the data to be displayed in the method differently. This is beyond the scope of this tutorial.

To create the methods for the implementation, proceed as follows:

  1. You are in the Object Navigator, in the enhancement implementation Z_TUTORIAL5_DATA_SUPPLIER, and the Enhancement Implementation Elements tab. You have expanded the BAdI implementation Z_TUTORIAL5_DATA_SUPPLIER in the navigation bar of the right-hand subscreen.

  2. Choose Implementing Class in this navigation bar. The group box Implementing Class contains entries for the methods IF_DFWK_DS_BADI_DATA~GET_CONTENT and IF_DFWK_DS_BADI_DATA~SET_CONTENT

    .

  3. In this tutorial, we do not need IF_DFWK_DS_BADI_DATA~SET_CONTENT, but you must create the implementation empty.

    Double-click on the method, confirm that you want to create the implementation, and that this object is in customer namespace.

    The empty coding of the method is displayed. Choose Back (Back).

  4. Create the IF_DFWK_DS_BADI_DATA~GET_CONTENT method implementation, by double-click. Answer the prompts appropriately.

  5. The coding of the method is displayed. Go to change mode with Display<->Change (Display<->Change), and copy the following lines into the coding:

    Syntax Syntax

    1. method IF_DFWK_DS_BADI_DATA~GET_CONTENT.
    2.     DATA: ls_data LIKE LINE OF e_data
    3.         .
    4.     CASE i_name.
    5.       WHEN 'FROM_BADI'.
    6.         e_header-field1  = 'LOC'.
    7.         e_header-field2  = 'EMP'.
    8.         e_header-field3  = 'PHN'.
    9.         ls_data-field1  = 'Location'.
    10.         ls_data-field2  = 'Number of Employees'.
    11.         ls_data-field3  = 'Number of Phones'.
    12.         APPEND ls_data TO e_data.
    13.         ls_data-field1 = 'Alexandria'.
    14.         ls_data-field2 = '1111'.
    15.         ls_data-field3 = '1413'.
    16.         APPEND ls_data TO e_data.
    17.         ls_data-field1 = 'Berlin'.
    18.         ls_data-field2 = '596'.
    19.         ls_data-field3 = '1494'.
    20.         APPEND ls_data TO e_data.
    21.         ls_data-field1 = 'Brest'.
    22.         ls_data-field2 = '534'.
    23.         ls_data-field3 = '1058'.
    24.         APPEND ls_data TO e_data.
    25.         ls_data-field1 = 'Brighton'.
    26.         ls_data-field2 = '1926'.
    27.         ls_data-field3 = '1180'.
    28.         APPEND ls_data TO e_data.
    29.         ls_data-field1 = 'Montalivet'.
    30.         ls_data-field2 = '1615'.
    31.         ls_data-field3 = '1408'.
    32.         APPEND ls_data TO e_data.
    33.         ls_data-field1 = 'Oslo'.
    34.         ls_data-field2 = '977'.
    35.         ls_data-field3 = '1415'.
    36.         APPEND ls_data TO e_data.
    37.         ls_data-field1 = 'Speyer'.
    38.         ls_data-field2 = '525'.
    39.         ls_data-field3 = '1493'.
    40.         APPEND ls_data TO e_data.
    41.         ls_data-field1 = 'Walldorf'.
    42.         ls_data-field2 = '616'.
    43.         ls_data-field3 = '1119'.
    44.         APPEND ls_data TO e_data.
    45.       WHEN OTHERS.
    46.    ENDCASE.
    47.  endmethod.
    End of the code.

    Note Note

    This specifies the following parameters:

    • i_name

      Content Name. When you register the app, you connect a Content Name with an Xcelsius connection. In this tutorial, the Content Name and Xcelsius connection are both FROM_BADI.

    • e_header

      This is a one-dimensional string structure, containing technical information to which the Xcelsius app can respond. We do not use this option in this tutorial, but the structure cannot be passed empty, so the implementation passes random values.

    • e_data

      This is a two-dimensional string structure, containing the values are passed via the Xcelsius connection (FROM_BADI) to the app, and displayed. In this tutorial, this is the additional information for the subsidiaries (number of employees and number of telephones).

    End of the note.
  6. Save your entries and activate all objects in this implementation, by selecting them and choosing Activate (Activate).

Result

You have created the BAdI implementation to supply data to the dashboard app. When registering the app in the Dashboard Framework (see Tutorial Part 5: Registering the App), you will specify the filter value of this implementation.