Which restrictions exist for ABAP SQL arithmetic expressions? Note: There are 2 correct answers to this question.

Which restrictions exist for ABAP SQL arithmetic expressions? Note: There are 2 correct answers to this question.
A . Floating point types and integer types can NOT be used in the same expression.
B . The operator/is allowed only in floating point expressions.
C . Decimal types and integer types can NOT be used in the same expression.
D . The operator is allowed only in floating point expressions.

Answer: BD

Explanation:

ABAP SQL arithmetic expressions have different restrictions depending on the data type of the operands. The following are some of the restrictions:

Floating point types and integer types can be used in the same expression, as long as the integer types are cast to floating point types using the cast function. For example, CAST ( num1 AS FLTP ) / CAST ( num2 AS FLTP ) is a valid expression, where num1 and num2 are integer types.

The operator / is allowed only in floating point expressions, where both operands have the type FLTP or f. For example, num1 / num2 is a valid expression, where num1 and num2 are floating point types. If the operator / is used in an integer expression or a decimal expression, a syntax error occurs.

Decimal types and integer types can be used in the same expression, as long as the expression is a decimal expression. A decimal expression has at least one operand with the type DEC, CURR, or QUAN or p with decimal places. For example, num1 + num2 is a valid expression, where num1 is a decimal type and num2 is an integer type.

The operator ** is allowed only in floating point expressions, where both operands have the type FLTP or f. For example, num1 ** num2 is a valid expression, where num1 and num2 are floating point types. If the operator ** is used in an integer expression or a decimal expression, a syntax error occurs.

Reference: sql_exp – sql_arith – ABAP Keyword Documentation, SQL Expressions, Arithmetic Calculations – ABAP Keyword Documentation

Subscribe
Notify of
guest
1 Comment
Inline Feedbacks
View all comments
nana
nana
14 days ago

There is no correct answer.