2009 Feb 17 1:35 PM
Hi Experts,
In my table EKET, I want to write a select query that gives me the fields EBELN, EBELP and ( MENGE - DABMG ). Is it possible to write a query in a way that the third column gives me the difference of the two database columns.
Thanks.
2009 Feb 17 1:40 PM
Hi,
This is not possible to select query.
You have pick all the four fileds after that you have to loop the internal table and write the logic manually.
Regards,
vinod
2009 Feb 17 1:56 PM
Hi,
You can do it in Internal table instead of doing that in dbtab.
Regards
PInaki
2009 Feb 17 2:01 PM
How can I do it in internal table, apart from looping?
modify itab transporting menge where menge - dabmg = 0 does not work.
Looping at a large internal table containing more than a hundred thousand records and changing the values will create performance issues.
2009 Feb 17 2:10 PM
performance costs more if you are using Modify append etc in loop... for that we have a solution of using Field sysmbols, where we need not use modify statement...
loop at itab into <fs_itab>.
<fs_itab>-menge = <fs_itab>-menge - <fs_itab>-dabmg = 0 "your calculations....
endloop.
"if you are changing field symbol...entry in the table is also changed.
2009 Feb 17 2:17 PM
a nice tip to improve performance, I will check out the performance by using the same. any more tips will be welcome. but I believe a query using joins, will perform better than nested loops when the data is very large. I am using native SQL in few reports where performance was crucial from business point of view. But all the reports in the system cant be in native. (not a healthy practice) . Therefore, I am trying to write complex queries in ABAP to avoid loops.