SAP WHERE LOGEXP COMPARE

Get Example source ABAP code based on a different SAP table
  


ARTICLE
Short Reference
• = WHERE
• <> WHERE
• < WHERE
• > WHERE
• <= WHERE
• >= WHERE
• EQ WHERE
• NE WHERE
• LT WHERE
• GT WHERE
• LE WHERE
• GE WHERE

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. operatorMeaning =, EQTrue, if the content of col1 is the same as the content of the second operand. <(><<)>>, NETrue, if the content of col1 is not the same as the content of the second operand. <(><<)>, LTTrue, if the content of col1 is less than the content of the second operand. >, GTTrue, if the content of col1 is greater than the content of the second operand. <(><<)>=, LETrue, if the content of col1 is less than or the same as the content of the second operand. >=, GETrue, 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.