In this section we'll extract the Sales Headers using an ABAP CDS View and the SAP Table Adapter.
The ABAP CDS View can be found here. Note in the annotations the ABAP Dictionary name by which the CDS View can be found in the SAP Data Dictionary (transaction SE11 or SE11n)/
@AbapCatalog.sqlViewName: 'ZBD_ISALESDOC_E'
The extracted Sales Order headers will be saved in a SQL Table within the Synapse SQL Pool. We will begin with creating this table using an SQL Script.
- In the Azure Portal, select your Synapse Workspace.
- Select
Open Synapse Studio
- Select 'Develop'
- Create SQL Script
Note: Make sure to change the "Connect to" value from 'builtin' to your own SQL pool as shown in the screenshot below. As by default it will be connected to the 'builtin' SQL pool of Synapse.
<img src="images/synapsews/connectToPool.jpg"
CREATE TABLE SalesOrderHeaders(
BILLINGCOMPANYCODE nvarchar(4),
BILLINGDOCUMENTDATE date,
COUNTRY nvarchar(3),
CREATIONDATE date,
CREATIONTIME time,
CREDITCONTROLAREA nvarchar(4),
CUSTOMERACCOUNTGROUP nvarchar(4),
CUSTOMERGROUP nvarchar(2),
CUSTOMERNAME nvarchar(80),
DISTRIBUTIONCHANNEL nvarchar(2),
LASTCHANGEDATE date,
LASTCHANGEDATETIME decimal(21,0),
MANDT int,
ORGANIZATIONDIVISION nvarchar(2),
PRICINGDATE date,
PURCHASEORDERBYCUSTOMER nvarchar(35),
SALESDISTRICT nvarchar(6),
SALESDOCUMENT nvarchar(10) NOT NULL,
SALESDOCUMENTPROCESSINGTYPE nvarchar(1),
SALESDOCUMENTTYPE nvarchar(4),
SALESGROUP nvarchar(3),
SALESOFFICE nvarchar(4),
SALESORGANIZATION nvarchar(4),
SDDOCUMENTCATEGORY nvarchar(4),
SOLDTOPARTY nvarchar(10),
TOTALNETAMOUNT decimal(15, 2),
TRANSACTIONCURRENCY nvarchar(5),
CITYNAME nvarchar(35),
POSTALCODE nvarchar(10)
)The sales order headers are extracted from SAP using the SAP Table Adapter which uses an RFC.
The CDS View to extract from is : ZBD_ISALESDOC_E.
Note: You can have a look in the SAP system to check the contents. Use the Data Dictionary, transaction
SE11.
- In Synapse Studio, go to the
ManageView
- Select
Linked Services
- Create a new
Linked Serviceof typeSAP Table Connector
- Enter the connection details for the SAP System, we used the name
S4DCLNT100ODP. Use the username and password for the SAP system provided to you at the start of the Microhack. - Use the Integration Runtime which you installed in the previous steps
Note : use
Test Connectionto verify your settings
Note : SAP Connection Details will be handed out before the MicroHack
Create an Integration DataSet based on the previously created Linked Service.
This dataset will act as the source.
- Switch to the
DataView - Create a new
Integration Dataset
- Use type
SAP Table
-
Use your previously created Linked Service for the SAP System (Table connector), as name we used
S4DCLNT100 -
Use
ZBD_ISALESDOC_Eas table, it can take some time before the list of tables is loaded -
Use
Preview Datato check if the data can be retrieved
- Once the information is entered succesfully and the data can be retrieved, leave the tab as-is. We will publish the changes after the rest of the components of this data flow are done.
Note : the source code of the CDS View can be found here
-
this will represent the target/sink of the pipeline
-
Switch to the
Manageview -
Create a new Linked Service of type
Azure Synapse Analytics, as name we usedSynMicroHackPool
Note: Since this linked service represents the Synapse SQL pool, it will be re-used in the
SalesOrderItemsandPaymentspipeline.
This dataset will act as the sink in our pipeline.
-
Switch to the
DataView -
Create a new
Integration DataSetfor the Synapse Sales Orders
-
As a name we used
SynSalesOrderHeadersand for the linked service we used the one we just createdSynMicroHackPool -
Select the
SalesOrderHeaderstable
- Again leave the information on the tab as-is and move to the next step
- Swith to the
Integrateview
- Create a new
Pipeline, we usedExtractSalesOrderHeadersas a name
- Use the
copy actionby dragging it onto the pipeline canvas
- In the
sourcetab, select your SAP Sales Order Dataset as the source
- In the
sinktab, select the Synapse Sales Order Dataset as the sink
Note : Ensure to select
PolyBase
- In the mapping tab, choose
Import schemas. Since source and target fields have the same name, the system can auto-generate the mapping
- For the prediction model we will calculate the offset between the billing document date and the actual payment data. For this we need to have these date fields mapped to SQL Date fields. Therefore, go to the JSON Code for the pipeline and add
convertDateToDateTimeandconvertTimeToTimespanparameters.
Add the parameters convertDateToDatetime and convertTimeToTimespan at the existing typeproperties > source element. The resulting document should looks as follows :
"typeProperties": {
"source": {
"type": "SapTableSource",
"partitionOption": "None",
"convertDateToDatetime": true,
"convertTimeToTimespan": true
},
"sink": {
...-
In the
Settingsblade,enable stagingand use the existing Linked Service to the Synapse Data Lake. -
Enter the path to the staging directory of your Azure Data Lake. The staging directory
sap-data-adls/staging, was already created by the Terraform script.
- Now
Publish alland once this is successfull trigger the pipeline, useAdd trigger->Trigger now->OK
- Swith to the
Monitorview to monitor the pipeline run
- Check the result in Synapse using SQL. You can do this via the
Developview and create a new SQL script.
select count(*) from SalesOrderHeaders
select * from SalesOrderHeaders
























