6.3    SAP BW/4HANA Data Flows

Data flows are visual modeling elements to help you connect several InfoProviders and create transformations of data among them. Figure 6.30 shows an example of an SAP BW/4HANA data flow using an SAP ERP DataSource and linked to an Advanced DSO as a target.

You can save the data flows you create, and several flows can be defined that share the same DataSources and InfoProviders. You can check which objects in SAP BW/4HANA use another by right-clicking the object you want to check and selecting Where-Used….

Example SAP HANA Data Flow

Figure 6.30    Example SAP HANA Data Flow

An example of the where-used list for the DataSource SALESHDR is shown in Figure 6.31. You can see that this DataSource is used in two data flows, one transformation, and one data transfer process.

Where-Used List for DataSource

Figure 6.31    Where-Used List for DataSource

The following subsections describe the creation of an SAP BW/4HANA dataflow, how to connect objects in the data flow, and creation of transformations between a source and target objects.

6.3.1    Creating a Data Flow

You can create a data flow via the File New Data Flow… menu or via the context menu of an InfoArea node, project node, or data flow node under an InfoArea. On the parameters screen (see Figure 6.32), define the technical name of the data flow and its description. Also, you can associate it with an InfoArea and a package for transporting it to other environments. Then, click the Finish button.

Data Flow Parameters Screen

Figure 6.32    Data Flow Parameters Screen

The data flow designer screen will appear, ready to create the data flow. You can add SAP BW/4HANA objects into the data flow by dragging and dropping them from the Project Explorer panel or from the Palette panel on the right side of the screen (shown in Figure 6.30).

Once you added the necessary InfoProviders in the data flow, you can connect them via connections. To create a connection, hover your mouse pointer over the object you want to be the source of the connection; action buttons will appear, as shown in Figure 6.33.

Data Flow Object Action Buttons

Figure 6.33    Data Flow Object Action Buttons

Click and hold the right-pointing arrow button from the source object and drop it into the target. Once the connections are created (see Figure 6.34), options to create transformations and data transfer processes are available.

Data Flow with Connections

Figure 6.34    Data Flow with Connections

6.3.2    Creating Transformations

Transformations are sets of rules and programming logic to consolidate, cleanse, and apply business rules to the data being transferred from a source provider to a target provider in SAP BW/4HANA.

You can create transformations in the following ways:

The other options in the Transformations submenu are the existing transformations already created for the object, a proposed transformation according to the connection created, and the Create Transformation… option, which allows you to create a different transformation from another source.

Once you select the option to create a new transformation, a pop-up screen will display to confirm the source and target for your transformation. Once you proceed, the transformation designer screen will appear, and the system may propose mappings for the source and target fields. You can change the proposed options and create new rules.

On the left side of the screen, as shown in Figure 6.36, you’ll see the source object and its fields. On the right side of the screen, you see the rule group. To show the target as well, click the Switch Detail View On/Off button inline image.

Transformation Designer Screen

Figure 6.36    Transformation Designer Screen

The transformation designer allows you to apply different sets of transformations and rules to fields and to the overall transformation itself.

During the transformation process, you have four main stages in which you can apply rules:

  1. Before record transformation
    You can create a set of rules to be applied to the data available in the source structure before it’s passed to the transformation of records step that will create the data in the target structure. This set of rules is a programming routine created via the Start Routine application button.
  2. During record transformation
    You can create a set of rules to be applied to each field of the data during the transformation of each record when creating the data in the target structure. This set of rules is run inside of each field mapping and has the following options, as shown in
    Figure 6.37:
    • No Transformation
      Keeps the target field set to null or unassigned value.
    • Constant
      Allows you to apply a constant to the target field.
    • Direct Assignment
      Moves the data from the field indicated as a Source Field of the Rule to the Target field of the Rule.
    • Formula
      Allows you to create a formula using a wizard.
    • Read Master Data
      Allows you to read values from an InfoObject provider—for example, if the source field is Customer Number and you want to retrieve the Account Group to be stored in the target InfoProvider of this rule.
    • Read from Data Store (Advanced)
      Allows you to perform a lookup on an Advanced DSO to retrieve an information according to the key of the Advanced DSO. For example, from the Sales Order number as a source field of the rule, you can read the Sales Order Header DSO details and have the Sales Order type stored in the target InfoProvider for this rule.
    • Routine
      When more complicated logic is necessary to map the data from a list of source fields for this rule to a target field, you can create programming routines.
  3. After the record transformation
    You can create a set of rules to be applied to the data available in the target structure after the data in the target structure is created and before the aggregation operations. This set of rules is a programming routine created via the End Routine application button.
  4. Aggregation operations
    You can define aggregation operations for each numeric field in the transformation. These operations are either Overwrite or Summation. Overwrite replaces the key figures for the records with the same key on the Advanced DSO while Summation performs an addition operation on these key figures. They’re performed after the completion of the data in the target structure creation, meaning after the End Routine process in the transformation (if it exists).
    Field Routine Options

    Figure 6.37    Field Routine Options

Rules for each field as shown in Figure 6.36 are created by dragging the source field and dropping it on the target field. This creates a direct mapping from the source field to the target. Alternatively, you can double-click the target field to access the Rule Details screen, as shown in Figure 6.37, from which you can select the Rule Type and add the Source Fields manually.

The following subsections describe additional properties and functions of the transformation and the process to enable the transformation to be fully processed by the SAP HANA database in the SAP BW/4HANA system.

6.3.3    Currency Conversions and Unit of Measures Validation

You can perform automatic currency or unit of measure translation during the transformation in the settings for currencies and units, accessed via the menu path Menu Edit Settings: Currencies and Units.

Prerequisites
  • All currencies and units of measure must be contained in the key of the target InfoProvider.
  • When using Advanced DSOs, translation/conversion of currencies and units is only supported with InfoObjects.

You can also activate the consistency check for units of measure in the settings for currencies and units. This prevent records with initial values in units of measure fields from being updated in the target.

6.3.4    Transformation Version Management

You can track the changes for the transformation of a given period, fall back to a previous version, compare versions, or create a new version via the Version Management tool: Menu Goto Version Management.

6.3.5    Transformation Metadata View

Via Menu Extras, you can view the ABAP-generated program, view the generated SAP HANA transformation, or view the transformation metadata in a tabular form (the Tabular Overview option), as shown in Figure 6.38.

Transformation: Tabular Overview

Figure 6.38    Transformation: Tabular Overview

6.3.6    Transformation Runtime Status

Depending on the method of programming you selected for the transformation, if you use ABAP-Managed Database Procedures (AMDPs) for all routines, the transformation may be executed in the SAP HANA database. To check if SAP HANA execution is possible, click the Check button to the right of the Runtime Status field. The check function simulates the creation of the transformation in the SAP HANA database. If it is successful, then the transformation is marked as possible to be executed in SAP HANA. Additionally, during the activation of the transformation, the system performs the same checks and if it is successful then the SAP HANA transformation is generated.

The generated SAP HANA transformation details can be found via Menu Extras Display Generated HANA Transformation.

When you’ve completed all the rules and there are no inconsistencies in the transformation, you can activate the transformation and return to the SAP HANA data flow. The transformation icon will be green, indicating the transformation is active.

6.3.7    ABAP Managed Database Procedures

Routines can be programmed in the ABAP language as in previous versions of SAP BW for any database or as AMDPs for SAP HANA execution. When using an AMDP, the system creates an ABAP class associated with the transformation routine. This class has the following sections:

Figure 6.39 shows an example of an exchange rate conversion of an amount. The fields Amount (AMOUNT) and Exchange Rate (FFACT) are mapped from the source structure to the AMOUNT field as the target. This routine is applied in this transformation. This transformation doesn’t return any errors to the handler.

AMDP Routine to Perform Exchange Rate Conversion

Figure 6.39    AMDP Routine to Perform Exchange Rate Conversion