Ansicht
Dokumentation

ABENWHERE_LOGEXP_SELTAB - WHERE LOGEXP SELTAB

ABENWHERE_LOGEXP_SELTAB - WHERE LOGEXP SELTAB

CL_GUI_FRONTEND_SERVICES - Frontend Services   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.
SAP E-Book

Short Reference

- IN range_tab

... operand $[NOT$] IN @range_tab ...

Effect

This variant of the operator IN checks whether the operands on the left side match a ranges condition in a ranges table. The relational expression is true if the value of the operand operand is (not) in the result set described in the rows of the ranges table range_tab specified as a host variable.

  • The following applies to operand:

  • Any internal table whose row type corresponds to that of a ranges table can be specified for the ranges table range_tab. This includes, in particular, selection tables.

The ranges table is evaluated in the same way as in comparison expressions, with the difference that any comparisons using the operators CP and NP are transformed into LIKE conditions for which the escape character "#" is defined. The pattern after CP or NP is transformed to a pattern for LIKE as follows:

  • If the wildcard characters "%" are contained in the pattern, the "#" escape character is inserted in front of these characters.
  • Any wildcard characters "*" and "+" that are not prefixed with the escape character "#" are transformed to the wildcard characters "%" and "_".
  • Any "#" escape characters that do not prefix themselves or the wildcard characters "%" and "_" are removed.

If the ranges table is initial, the expression IN range_tab is always true. This overrides the general rule that the result of a relational expression is unknown if an operand has the null value.

The content of the columns LOW and HIGH in the ranges table must match the data type of the operand in accordance with the rules for lossless assignments. This is checked by the strict modes of the syntax check from Release and can raise an exception.

Notes

  • LIKE conditions resulting from CP or NP are case-sensitive, which is not the case in ABAP comparison expressions.
  • If no conditions are specified apart from IN range_tab, all rows of the data source are selected if the ranges table is initial.
  • The conditions specified in the ranges table are passed by the database interface to the database as SQL statement input values. The maximum number of input values depends on the database system and is usually between 2000 and 10000. If the maximum number is exceeded an exception of the class CX_SY_OPEN_SQL_DB is raised.
  • For an initial ranges table, no condition is passed to the database and therefore, the result is always true.
  • If the ranges table contains invalid values, an uncatchable exception is raised.
  • No host expression can be specified on the right side whose result represents a ranges table.

Example

A ranges table is filled as follows and the order of the rows is not important:

SIGN  OPTION  LOW              HIGH
---------------------------------------
I     EQ      01104711
I     BT      10000000         19999999
I     GE      90000000
E     EQ      10000911
E     BT      10000810         10000815
E     CP      1%2##3#+4++5*

When used in sql_cond, this generates the following combination of relational expressions:

... ( ID = '01104711'                      OR
      ID BETWEEN '10000000' AND '19999999' OR
      ID >= '90000000' )                     AND
    ID <> '10000911'                         AND
    ID NOT BETWEEN '10000810' AND '10000815' AND
    ID NOT LIKE '1#%2##3+4__5%' ESCAPE '#'   ...

Example

Use of a selection table defined for a selection screen with SELECT-OPTIONS in a WHERE clause.






CL_GUI_FRONTEND_SERVICES - Frontend Services   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 7460 Date: 20240425 Time: 173046     sap01-206 ( 74 ms )