---
parser: v2
auto_validation: true
time: 15
author_name: Thomas Jung
author_profile: https://github.com/jung-thomas
tags: [ tutorial>beginner, products>sap-hana, tutorial>license]
primary_tag: software-product>sap-hana-service-for-sap-btp
slug: haas-dm-create-flowgraph-sdi
canonical_url: https://developers.sap.com/tutorials/haas-dm-create-flowgraph-sdi
---

# Create a Flow Graph to Replicate Data

<!-- description --> Create a flow graph using SAP HANA service smart data integration for SAP BTP to replicate data into SAP HANA service for SAP BTP.

## Prerequisites

- This tutorial is designed for SAP HANA service for SAP Business Technology Platform. Consider newer tutorials designed for SAP HANA Cloud.
- You have configured SAP HANA service smart data integration for SAP BTP [as explained in this tutorial](haas-dm-connect-sdi).
- You have created a remote source and configured the access [as explained in this tutorial](haas-dm-access-cross-container-schema).

## You will learn

- How to Create a Virtual Table in SAP Web IDE
- How to create a flowgraph to load data from the virtual table

## Intro

>**This tutorial cannot be completed with a trial account.**
---

### Create a Virtual Table


Create a new virtual table in `db/data`.

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/7.png)

Call it `vt_salary_data` and flag **Generate configuration file**

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/9.png)

Fill the Properties as follows:

  - Remote Source Name: `LocalFile`
  - Database and Schema name: `<NULL>`
  - Object Name: `salarydata`

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/10.png)

**Save** and open the **File Format Editor**

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/11.png)

Here you can adapt the inbound file format. Change  **Skipped Header Lines** to 1.

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/12.png)

Copy the following lines to the simulation and run it. These have been taken from the `salarydata.csv` file

```text
ID,SALARY,START_YEAR,GENDER,REGION,T-LEVEL
100001,139171,1998,m,APJ,T5
```

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/13.png)

Use the **Copy** function and then use the pencil to edit the data types

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/14.png)

Change the types as follows:

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/15.png)

**Save** and **Build** the database module

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/16.png)


> As a reference, here is the code for the virtual table. You can access this mode by right-clicking on the virtual table artifact and choosing **Open Code Editor**.
>
> ```text
> VIRTUAL TABLE "vt_salary_data" AT "LocalFile"."<NULL>"."<NULL>"."salarydata"
> REMOTE PROPERTY 'dataprovisioning_parameters'='<?xml version="1.0"  encoding="UTF-8" standalone="yes"?>
> <Parameters>
> <Parameter name="FORMAT">CSV</Parameter>
> <Parameter name="FORCE_FILENAME_PATTERN">%.csv</Parameter>
> <Parameter name="PARTITIONS">0</Parameter>
> <Parameter name="CODEPAGE">utf-8</Parameter>
> <Parameter name="LOCALE">en_US</Parameter>
> <Parameter name="SKIP_HEADER_LINES">1</Parameter>
> <Parameter name="ROW_DELIMITER">\n</Parameter>
> <Parameter name="QUOTED_TEXT_CONTAIN_ROW_DELIMITER">false</Parameter>
> <Parameter name="COLUMN_DELIMITER">,</Parameter>
> <Parameter name="EXPONENTIAL">E</Parameter>
> <Parameter name="LENIENT">true</Parameter>
> <Parameter name="COLUMN">ID;INTEGER;</Parameter>
> <Parameter name="COLUMN">SALARY;FLOAT;</Parameter>
> <Parameter name="COLUMN">START_YEAR;INTEGER;</Parameter>
> <Parameter name="COLUMN">GENDER;NVARCHAR(1);</Parameter>
> <Parameter name="COLUMN">REGION;NVARCHAR(4);</Parameter>
> <Parameter name="COLUMN">T-LEVEL;NVARCHAR(200);</Parameter>
> </Parameters>';
>```




### Create a Flowgraph artifact


Create a new `Flowgraph` in `db/data`

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/1.png)

Call it `salary_flow`

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/2.png)


### Add the data source


Click on the **+** button to add a node

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/3.png)

Choose **Data Source**  

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/4.png)

Click on the canvas to drop the node and then click **configure**

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/5.png)

Choose **HANA Object**

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/6.png)

Look for the virtual table `vt_salary_data`. Choose it and click **Create**.

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/8.png)

Mark all the control fields and delete them

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/17.png)

Click **Apply**



### Add a Data Target


Use the **+** sign to create a data target and drag the arrow from  the source to the target

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/20.png)

Click **Configure** on the target node

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/19.png)

The target mapping should be populated automatically using the source. Use `TGT_SALARIES` as the name of the target table.

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/21.png)

**Save and build** the Flowgraph.

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/22.png)


### Execute the Flowgraph


Click on **Execute** in the Flowgraph.

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/23.png)

Confirm the warning

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/24.png)

You will see a success message in the console

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/25.png)


### Check data


Right-click on the database module and choose **Open HDI Container**

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/26.png)

In the HDI container, navigate to **Tables** and you will find the table created by the flowgraph. Right-click on it and choose **Open Data**

![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/27.png)

Use ![Create Flowgraph](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/haas-dm-create-flowgraph-sdi/edit.png) **Edit SQL statement** to modify the select statement for a `SELECT COUNT(*)`. Count the total records to complete the validation below




---
