Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select query - Result as formula on two numeric columns

Former Member
0 Likes
820

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.

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.

5 REPLIES 5
Read only

Former Member
0 Likes
788

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

Read only

Former Member
0 Likes
788

Hi,

You can do it in Internal table instead of doing that in dbtab.

Regards

PInaki

Read only

0 Likes
788

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.

Read only

0 Likes
788

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.

Read only

0 Likes
788

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.