Please also have a look in our OnlineHelp for further information.

If you want to use the current date in a where clause, you have to convert the date into a format SAP understands. This is possible by using a Script Task.

First we need to create an SSIS Variable called “TDatum” (data type String, scope Package).

ScriptTaskVariables

After creating the variable we insert a Script Task.

ScriptComponentDataflow

Double-click on the Script Task and insert the recently created variable in the field ReadWriteVariables. With the button “Edit Script…” the script editor opens.

Scriptscreen

Insert the following code into the script editor.

[C#]
public void Main()
   {
           Dts.Variables["TDatum"].Value =  DateTime.Now.ToString("yyyyMMdd"); 
           Dts.TaskResult = (int)ScriptResults.Success;
   }

This code converts the current date to the format year, month and day without any delimiter, and stores the value in the variable “TDatum”. Now we can use this variable in an Xtract IS Table Component to make the where clause dynamic.

VariableInTable

The tasks are executed in a row.

DataFlows