sapdev logo background
sapdev logo sapdev logo
Comments

SAP WHERE LOGEXP COMPARE documentation, setup help and example usage



Return to SAP documentation index


ARTICLE
Short Reference

sql_cond - Relational Operators

Syntax
... col1 operator {dobj}
| {col2}
| { [ALL|ANY|SOME] subquery } ...

Effect
The relational expression compares the content of the column col1
with the content of one of the following operands, in accordance with the relational operator operator :
  • An ABAP data object dobj as a host variable

  • Another column col2 in a database table specified after FROM

  • . Here, col2 must be specified as dbtab~comp or
    tabalias~comp using the column selector .
  • A scalar subquery subquery

  • The following table shows the possible relational operators.
    operator Meaning
    = , EQ True, if the content of col1 is the same as the content of the second operand.
    , NE True, if the content of col1 is not the same as the content of the second operand.
    , LT True, if the content of col1 is less than the content of the second operand.
    , GT True, if the content of col1 is greater than the content of the second operand.
    = , LE True, if the content of col1 is less than or the same as the content of the second operand.
    = , GE True, if the content of col1 is greater than or the same as the content of the second operand.
    Note the following when using these operators:
  • If the second operand is an ABAP data object, it is (if necessary) converted to the data type that matches the type of the column col1

  • in accordance with the table of predefined types in ABAP Dictionary .
  • If the second operand is a column of a database table specified after FROM , the types and length of both operators must be equal; otherwise the result depends on the database system.

  • In greater than/less than comparisons with character-like columns, the result can depend on the code page used by the database system.


  • Note
    The obsolete forms , =
    , and = of relational operators may still appear outside of classes.

    Example
    Gets overbooked flights.
    TYPES: BEGIN OF sflight_tab_type,
    carrid TYPE sflight-carrid,
    connid TYPE sflight-connid,
    fldate TYPE sflight-fldate,
    END OF sflight_tab_type.

    DATA sflight_tab TYPE TABLE OF sflight_tab_type.

    SELECT carrid connid fldate
    FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE sflight_tab
    WHERE seatsocc > sflight~seatsmax.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    WHERE_LOGEXP_ANDORNOT
    WHERE_LOGEXP_DYNAMIC




    comments powered by Disqus