# Arithmetic Calculation

ABAP HANA 7.51: Arithmetic Calculation

With ABAP 7.4+, it is now possible to do basic arithmetic calculation inside SQL query. Some arithmetic operations which are now possible are:

• Subtraction,
• Multiplication,
• Division, and
• Calculating remainder value(MOD)

Apart from basic mathematical operations, new ABAP offers a good number of value-added bonus operations which make ABAPing faster and elegant. To name a few of them would be:

• ABS(argument) – Gives absolute value of argument
• DIVISION(argument1,argument2,DEC) – Result is division of argument1
“by argument2 and rounded to DEC number of places
• DIV(argument1,argument2) – Gives Integer part of Division operation
• FLOOR(argument) – Provides just immediate smaller neighbor Integer
• CEIL(argument) – Provides just immediate bigger neighbor Integer
• DATS_ADD_DAYS(date1, dayCount,if_error) – Returns a date, dayCount days after date1
• DATS_DAYS_BETWEEN(date1,date2) – Returns interval between 2 dates
• COALESCE(argument1,….) – Returns first non-null argument
• CONCAT_WITH_SPACE(argument1,argument2,) – concatenates
“arguments with number of spaces provided in 3rd argument
• CONCAT(argument1,….) – concatenates arguments, trailing blanks are not taken into account
• LENGTH(argument) – Gives length of argument but ignores trailing blanks
• LOWER(argument) – Converts the string argument to lower case

Sample Source Code: Output:

The output will create an Internal table with four columns. Name of the fourth column will be ‘SEATSFREE’ and it will be a calculated value.

## One thought on “Arithmetic Calculation”

1. Rahul Abrol says:

We cannot use divide and mod operator in select.