- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Problem with division as output is either 0 or 1 when using ifthenelse condition in ABAP program
The problem is that your second parameter is 0 which is an integer, so the output always comes as an integer as ifthenelse takes data type from the second parameter. So, in your case, if the answer is less than .5, it is converted to zeroes and in case more than .5, it is converted to 1. You would require to use cast for the second parameter to convert it to decimal data type as follows
ifthenelse(Query.Den= 0, cast(0, 'Decimal(16, 02)'), Query.Num / Query.Den)
- Related Articles
- Maximum length subarray with difference between adjacent elements as either 0 or 1 in C++
- Maximum length subsequence with difference between adjacent elements as either 0 or 1 in C++
- Adding a condition using SQL or an ABAP program and difference in performance
- Maximum length subsequence with difference between adjacent elements as either 0 or 1 | Set 2 in C++
- Python Program for 0-1 Knapsack Problem
- Maximum value with the choice of either dividing or considering as it is in C++ program
- C++ Program to Solve the 0-1 Knapsack Problem
- 0-1 Knapsack Problem in C?
- Inserting new line to the output using WS_Download in ABAP
- Usage of subqueries in internal table as condition in SAP ABAP source code.
- Maximum value with the choice of either dividing or considering as it is in C++
- Maximum determinant of a matrix with every values either 0 or n in C++
- ABAP constants with %_ as prefix
- Get a matrix as Output if a condition for a single value is met in R.
- Program to print its script name as output using Python

Advertisements