Application Development 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: 

Sum Total of a column in custom field in sap query

Former Member
0 Kudos

Hello Experts,

i have created a query using logical database IOC.

I need to use the sum total of a column in another field.

Can we achieve this using local field in sq01 but am not getting the formula for summing the total of a column.

I tried adding a additional field in sq02 and tried some codes reference from other SCN blogs but still did not work

I wanted to use the total of a column in another field .

Thanks,

Vivek

9 REPLIES 9

jogeswararao_kavala
Active Contributor
0 Kudos

According to me such are the requirements need to involve the internal tables of Query, which is not easy. So for such requirements ABAP report programs would be better.

michael_kozlowski
Active Contributor
0 Kudos

Additional field in InfoSet(SQ02) is the right direction. Maybe you can share more details about your requirement.

0 Kudos

requirement is i want to use the sum total of IOOPCOMP-ENWRT in another field.

I created a additional field TOTVAL in sq02 and included below code

select sum (ENWRT ) FROM IOOPCOMP

   WHERE IOOPCOMP-WERKS = '9100'.

got the below error.

"IOOPCOMP" is not defined in the ABAP Dictionary as a table, projection.

code was just take from other post. Please help me in getting the code working.or alternate solutions to fulfill my requirement.

Thanks,

Vivek

0 Kudos

As I mentioned the Total value at run-time can be derived only by accessing the internal tables of the program.

0 Kudos

yes i understand. So this means to say that i will have to go with ABAP report program right.No other Alternatives

0 Kudos

According to me it is YES. I always did.

0 Kudos

Try with

SELECT SUM( enwrt ) INTO totval FROM resb

WHERE werks EQ '9100'.

0 Kudos

Run-time error "DBIF_RSQL_INVALID_RSQL"

0 Kudos

Check field totval defined for node IOOPCOMP with  LIKE-Reference IOOPCOMP-ENWRT and coding is assigned to Field totval.