‎2008 Feb 28 11:41 AM
Hi,
In an ABAP select statement, how to do operations on two columns of a dictionary transparent table(say division or multiplication on two column values) ?
Reward points will be awarded .
TIA
Regards,
Anindita
‎2008 Feb 28 11:46 AM
HI,
I don't think this can be achieved using OPEN SQL.
Regards,
Atish
‎2008 Feb 28 11:47 AM
I am not sure whether on a SELECT statement operations like subtraction, division or multiplication on DB columns can be performed.
You may have to select the columns into an internal table and then loop thru the internal table to perform the necessary division or multiplication operations.
Hope this helps.
Thanks,
Balaji
‎2008 Feb 28 11:47 AM
Hi,
There are some aggregate functions which can be used for columns in the database.
Those are: SUM, MAX, MIN, AVG and COUNT.
This above functions can be used accorddingly in the select queries like:
select vbeln posnr sum (netwr)
into gi_vbap
from vbap
where vbeln = ............
There is no operations fpor mulitply/divide.
Hope this helps.
Regards,
JLN
‎2008 Feb 28 11:48 AM
Hi Anindita
Can you please explain in detail what exactly you want to do so that i can help better.
Regards
Lakshmikanth
‎2008 Feb 28 11:51 AM
Hi kumar,
Use this sample code..
Loop at internaltable
compute internaltable-total = internaltable-value1 + internaltable-value2.
modify internaltable.
endloop.
Regards,
Ramanan
‎2008 Feb 28 12:11 PM
hi,
see the below link
i hope it will useful for u .
http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/content.htm
SELECT AVG(salary) FROM employees
SELECT COUNT(*) FROM employees
SELECT COUNT(DISTINCT employee_name) FROM employees
SELECT employee_name, salary + benefit
FROM employees
WHERE salary < 0.8 *
( SELECT MAX( salary ) FROM employees )
Arithmetic Expressions. For all employees that have a salary not exceeding 80% of the salary of the maximum salary of all employees, this query returns the name of the employee and the sum of its salary and its benefit.
reward if its useful
Edited by: p541399 on Feb 28, 2008 5:49 PM
‎2008 Feb 28 12:12 PM
Hi,
Try doing ur operations outside select. Store it in a variable and use it in select. This will enhance ur performance.
Regards,
Ramya