SAP Data Modeler - Working with Variants

SAP Data Modeler - Working with Variants

Working with Variants

This guide explains how to create, configure, and use variants within entities. Variants allow you to predefine parameters, dynamic dates, or selection options that can be reused across executions. By leveraging variants, you can streamline processes, ensure consistency, and schedule jobs more efficiently.

Getting Started

To begin working with variants for an entity, first execute the entity normally.


Next, select the fields you want to define as variants and click Save.

At this stage, it is not necessary to assign values to these fields, you can just leave the values in blank.

On the following screen, choose Save Variant to start defining the dynamic variants for the selected fields.




Defining a Variant

When creating a new variant, you will need to complete the following steps:

Assign a Name and Description: Provide a clear and descriptive name along with a short explanation of the variant’s purpose. This helps you and other users easily identify it later when running the entity. Make sure that the variant name doesn't exceed 14 characters.


Choose Fixed Variant (Optional): If you select the option Take values from previous screen, the system will save this as a Fixed Variant. In this case, the variant will use exactly the same field values you selected in the previous step (the screen where you identified the columns). This option is useful when you want to lock the variant to a specific predefined configuration.


Define Variable Values: In the table shown below, you will see all the fields that were selected as variables. For each field, you can assign values or logic conditions (such as ranges or dynamic dates) depending on the type of variable you want to configure.


Variable Types

For each variable, select the Variable Type. The following options are available:

  • T: Table Variable from TVARVC – Use a variable previously defined in TVARVC by referencing it.
  • D: Dynamic Date Calculation (Local Date) – Define a dynamic date based on the user’s local time (only available if the selected field is a date).
  • X: Dynamic Date Calculation (System Date) – Define a dynamic date based on the system’s local time (only available if the selected field is a date).

Using Table Variables from TVARVC

When selecting this option, enter the name of the parameter previously created in TVARVC under Explanation.


To create a parameter in TVARVC:

Access transaction STVARV.
Select Edit/Change.

Choose whether to create a Parameter or a Selection Option, then click Create.

Parameter: Assign a name and a fixed value for the variant, then save.


Selection Option: Assign a name and the required ranges or multiple values. You can also include logical conditions (e.g., include, exclude, greater than). Then save.



Using Dynamic Date Calculation

Dynamic Date Calculation is especially useful when you need to work with dates that change depending on when the entity is executed. Instead of setting a fixed date, you can define a relative date or a range of dates that will always adjust automatically to the execution time.

To configure this type of variable, follow these steps:

Select SIGN:
In the SIGN column, decide whether you want to include or exclude the values:
  1. I (Include): The system will use the selected date(s) as part of the results.
  2. E (Exclude): The system will filter out records that match the selected date(s).
KEEP IN MIND THAT YOU CAN SELECT ONLY ONE OPTION PER VARIANT, SO MAKE SURE TO ONLY ASSIGN ONE SING.

Select Option:
In the Option column, define the logical condition that applies to the date field. Some common options include:
  1. Equal: Matches an exact date.
  2. Not Equal: Excludes a specific date.
  3. Greater Than: Includes records after a specific date.
  4. Less Than: Includes records before a specific date.


Enter Values (X and Y):
If the option you choose requires one or more values (X and Y values) , a new window will appear where you can define the relative values for X and Y. Use the following signs:
  1. X Value: Number of days
  2. Y Value: Number of days
  3. - (minus): Indicates past days relative to the execution date.
  4. + (plus): Indicates future days relative to the execution date.

Example: Suppose you want to extract data created between today and the last 10 days. In this case:
  • Y Value +0 = today’s date.
  • X Value -10 = 10 days before today.
This ensures that every time the entity runs, it automatically adjusts to always include today and the past 10 days.

Once you confirm the values, click Save. The variant will now be stored and can be reused in future executions or scheduled jobs, ensuring consistent and dynamic date filtering.


Executing Entities with Variants

Once a variant has been created for a specific entity, a new field called Variant will appear when executing the entity. By clicking the matchcode, you can select any previously saved variant for that entity.


From here, you can run the entity in real time or schedule a job for one-time or periodic execution using the defined variant.

    • Related Articles

    • SAP Data Modeler - Working with the entity "ANY"

      Introduction This document provides a step-by-step guide for creating and configuring an entity within Onibex's SAP Modeler using transaction ZONT_ONECM. It outlines the essential processes, including selecting the appropriate domain and data type, ...
    • SAP Data Modeler - Working with prepackaged entities (Excel)

      Uploading prepackaged Entities Onibex offers prepackaged entities that include predefined structures with tables and relationships designed for multiple SAP business processes. Uploading a prepackaged entity helps save time during the entity creation ...
    • Onibex SAP Data Modeler - Functionalities

      Introduction The following table outlines key functionalities offered by the SAP Data Modeler, highlighting features designed to enhance data extraction, customization, and integration within SAP environments. No Function Description 1 Direct Data ...
    • SAP Data Modeler - Identifying CDS Views Compatible with OneConnect Modeler

      The purpose of this manual is to provide a simple and practical guide to identifying CDS views within SAP that are compatible with the OneConnect Data Modeler. It outlines the necessary steps in a clear and concise manner, allowing users to quickly ...
    • SAP Data Modeler - Customizing Parameters

      OneConnect Parameter Adjustments The OneConnect solution includes a parameter table used for sending information—especially real-time data. It is important to configure this table beforehand, prior to sending any data, to ensure proper communication ...