7 Creating a Package for Delta Extraction

This chapter describes how to create a package for delta extraction.

So far we have seen examples of extracting data from BW data targets. The instructions in this chapter explain how the mappings introduced in the previous chapters can be turned into delta extraction mappings.

In delta extraction mappings only the data, which was changed after last extraction, is extracted. Delta extraction mappings are only supported for InfoCubes, ODS/DSO and Open Hub objects, but not for InfoObjects.

This chapter includes the following sections:

Modify the Mapping Flow

The first step is to modify the mapping:

  1. Select the desired Mappings.

  2. Double click the mapping.

  3. Select the Physical diagram.

  4. In the target group, select the access point for the source group.

  5. In the Property panel, under Loading Knowledge Module, set KM option values for FIRST_REQ_ID and LAST_REQ_ID KM as shown below.

    Description of image126.jpg follows
    Description of the illustration image126.jpg

  6. From the File menu, click Save and close your mapping.

Creating the MIN_REQUEST_ID Variable

The second step consists of creating an ODI variable that stores the last extracted request ID. This request ID serves as the starting point for the next extraction run:

  1. Create a MIN_REQUEST_ID variable to hold the last request id. The MIN_REQUEST_ID variable has to be a numeric variable with a Keep History or Last-value Action as shown below.

    Description of image128.jpg follows
    Description of the illustration image128.jpg

  2. The value of this variable is updated at the end of the delta extraction package described in the third step. It happens once delta extraction is finished and the MAX REQUEST ID will be fetched from SAP BW system and will be stored into the ODI Variable (MIN_REQUEST_ID). The refresh expression shown here is used to update the variable:

    Description of image130.jpg follows
    Description of the illustration image130.jpg

Creating a Package for Delta Extraction

In the third step the building blocks created in the previous steps are put together: Variable and Mappings are arranged into a Package:

  1. Open the SAP Demo Project.

  2. Create a new Package named SAP Demo.

  3. Insert a Declare Variable step to this Package:

    Drag and Drop the MIN_REQUEST_ID variable and select the "Declare Variable" step type.

  4. Insert a Flow step to this Package:

    Drag and drop the Mapping created in the previous sections for InfoCube/ ODS or OpenHub-Extraction in the Package.

  5. Insert a Refresh Variable step to this Package.

    Drag and Drop the MIN_REQUEST_ID variable and select the "Refresh Variable" step type.

  6. Define the step sequence.

    1. Define the Refresh Variable step as the First Step.

    2. Link it to the Flow step that is the next step upon success.

    3. Link the Flow step to the Refresh Variable step that is the next step upon success and the last step in the Package. Add arrows between the variables.

    Your Package should look as shown on this screenshot.

    Description of image132.jpg follows
    Description of the illustration image132.jpg

Running the Package

To run the Package:

  • In the Projects tree view, expand the SAP Demo Project.

  • Select the SAP Demo Package.

  • Right-click and select Run.

  • In the Execution window, click OK.

  • In the Session Started window, click OK.

What happens when you execute the delta extraction Package?

First, Oracle Data Integrator initializes the variable MIN_REQUEST_ID with the last historized value (declare variable step). This value is then passed into ABAP extraction program to specify where to start the data extraction. The KM queries the SAP system for the highest assigned request ID. All data between min and max request ID will be extracted (mapping).

After the execution of the mapping the refresh variable step stores the highest request ID into MIN_REQUEST_ID for next extraction run.