Selection Criteria

USE: 

Selection criteria are used to fetch relevant records from tables specified in the previous step.  For each table, it must be specified how the rows should be selected based on values stored in variables or fetched from records from preceding steps. Technically the configuration is used to prepare WHERE conditions for database queries. The queries that will be generated will be used to fetch references and newly created documents.

PROCEDURE:

  1. For edited configuration object, select step in the DB Comparision rules screen:
  2. Double click on Selection Criteria
  3. Add selection criteria to the particular table selected in step 1.

Selection criteria consist of the following parameters

Parameter NameDescription
Field nameName of database field from database table defined for the step or one of the joined tables.
Select Options

SQL Comparison Operator based on the list:

= Equal
<> Not Equal
CS Contains String
SW Starts with
EW Ends with
> Greater
>= Greater or equal
< Less
<= Less or equal
IN In operator (can be used with reference type 'constant' and comma separated values)

Reference Type

Type of value used for comparison.
Available types:

  • variable - used to reference values from object variables
  • constant - constant value
  • DB reference - used to reference field from parent step to form parent-child relation
Reference Value

Reference value depending on Reference Type.

  • type = variable - name of the variable
  • type = constant - expected value 
  • type = DB reference - name of the field in the parent database table

(optional) SQL Logical operator used in case of multiple criteria are defined for the table.

Available options:

  • AND
  • OR

which means if the criteria should be considered together or separately

EXAMPLE:

Example 1. Fetch headers of reference and newly created sales order based on variable PO_ORDER_NUMBER

The variable PO_ORDER_NUMBER was configured to fetch from reference XML the field that contained the purchase order number. Then the variable was regenerated with a new value from the IFTT number range and substituted into the new XML.

The DB definition is Step 1, and the table name VBAK. Now let's see the selection criteria:

Field nameSelect OptionsRef. TypeRef. Value
BSTNK=VariablePO_ORDER_NUMBER

this means that the particular query, which will be built is:

SELECT * FROM VBAK WHERE BSTNK = value from PO_ORDER_NUBER, for example 'PO123'.

Example 2. We would like to fetch all order items for headers that were fetched in the first example.

The tables representing business document (The DB comparison rules screen):

Now we are editing selection criteria for step 2, which is VBAP (sales order items) table depended on parent step 1 (VBAK - sales order header):

Field nameSelect OptionsRef. TypeRef. Value
VBELN=DB ReferenceVBELN

that means: 

SELECT * FROM VBAP where VBELN = (Sales order number fetched from step 1. Technically, the value that was stored in VBAK~VBELN field). For example, '0000022519'.


If the conditions are built on the queries that use JOIN, then the field name must be specified with table name like for example VBKD~BSTKD

© 2017 - 2022 Int4 AG All rights reserved