‎2016 Apr 28 1:49 PM
Hi All!
I have a function module which gathering data from a ztable.
My ztable:
I wanted to populate ZEYCARPAN field as "ZEYTUFE * ZEYGH" when I used SELECT statement.
Is it possible?
‎2016 Apr 28 4:16 PM
Yes, it's possible to do the calculation immediately in the SELECT. See ABAP langauage documentation: SELECT sql_exp
At least on basis NW 7.4 SP08
Example:
SELECT a, b, a * b AS c FROM abc INTO @data(lt_abc).
Your internal table has three fields: a, b and c
‎2016 Apr 28 2:24 PM
Have you read the ABAP keyword documentation? Does it offer such a possibility?
‎2016 Apr 28 2:33 PM
If you want to get the ZEYCARPAN value as "ZEYTUFE * ZEYGH" into an INTERNAL table then it is possible BUT you should have SAP_BASIS/SAP_ABA components latest version. I think you should have at least 7.4 version to have this.
-Chandra
‎2016 Apr 28 3:43 PM
Hi
First you get the data through select statement into first internal table, then send the first internal table data to final internal table.
Finally you can loop there:
Sample Code:
LOOP AT IT_FIRST INTO WA_FIRST.
WA_FINAL-ZEYCARPAN = WA_FIRST-ZEYTUFE * WA_FIRST-ZEYGH.
CLEAR : WA_FIRST.
APPEND WA_FINAL TO IT_FINAL.
ENDLOOP.
Please let me know if my understood is correct.
Thanks,
Divya.
‎2016 Apr 28 4:16 PM
Yes, it's possible to do the calculation immediately in the SELECT. See ABAP langauage documentation: SELECT sql_exp
At least on basis NW 7.4 SP08
Example:
SELECT a, b, a * b AS c FROM abc INTO @data(lt_abc).
Your internal table has three fields: a, b and c
‎2016 Apr 29 1:11 PM
Dear Armin,
Here is my select statement as you suggested and its worked!
SELECT ( zeytufe * zeygh ) AS zeycarpan FROM zhrp008 INTO @wa_data.
By the way, the operator / is not allowed in integer expressions.
Thank you for your help.
Have a nice day!