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.
Showing results for 
Search instead for 
Did you mean: 

Not getting tha sum of columns of currency fields in output

Former Member
0 Kudos

Hi experts,

When I am running my program, for some columns like quantity i am getting the sum of that column when i choose the column and choose the sum button.

But when I am choosing any column like currency,and then choosing the sum button,It is not giving me the sum of the values.


UNIT VOLUME IN GBP is the column name.

Can u please suggest me what to do



Former Member
0 Kudos


Total sum will be done on Totalizable fields.

Sub total will be done on Non-Totalizable fields in ALV Report.

If u choose Currency then u have to do sub-total then u'll get sub total for all currency types.

We have two std buttons on ALV report Total Sum and sub-total.

Edited by: Selva M on Aug 25, 2009 1:59 PM

Edited by: Selva M on Aug 25, 2009 2:00 PM

0 Kudos

ya thanks for the is subtotalling,But Currency can also be totalized....

In the standard program SD_SALES_ORDERS_VIEW net value is doing the totaling.

Can u sugest how is it done???


0 Kudos

Hi Smitha,

What is the data type that you have used for that particular field.. Data type in the final internal tabel that you are using for ALV display?



0 Kudos


How can u totalize the currency field

if currency field having the values INR, USD,EUR then how u can calculate the total.

or u r saying currency field is amount field.

U can do sum only on Totalizable fields

0 Kudos

lets say i have a fild as netpr whose data type in table vbap is curency,but in the final internal table i have defined as

"netpr TYPE netwr_ap".

So now if i want to add it ,its giving that error as i mentioned erlier

0 Kudos


Then change the declaration part in the final internal Table.

Make it currency or quan fields then It'll work

0 Kudos

yes the values of the currency field has to be added.....The data type is currency in the corresponding tables.

0 Kudos

can you please tell us how you have defined the field and field catalog?

0 Kudos

SD_SALES_ORDERS_VIEW is the standard program.When i run it,and give some values from 6000 to 6600(doc no),

then when i choose the net value column and click on the sum button then,i get the output as

AUD 4,000.00

DKK 0.00

EUR 19,652.65

GBP 82,555,203.80

JPY 987,002,912

USD 18,895.00

For my program, this is not coming.

i n the final internal table the fields are defined as

netpr TYPE netwr_ap,

netpr_gbp TYPE netwr_a,

like this.So what to do now.Can u pls help


0 Kudos

Hi Smitha,

I wrote a sample code to test this..

I am able to total the amount fields. It has something to do with your data type..

Use for amount field data type NETPR

and for curency filed WAERK

below is the sample code i used.


DATA :oref TYPE REF TO cx_root,

text TYPE string.

DATA lr_table TYPE REF TO cl_salv_table.

DATA: lr_columns TYPE REF TO cl_salv_columns.

data gt_vbap type table of vbap.

data gs_functions type ref to cl_salv_functions.

select *

from vbap into table gt_vbap

UP TO 10 rows.




r_salv_table = lr_table


t_table = gt_vbap ).

CATCH cx_salv_msg INTO oref. "#EC NO_HANDLER

text = oref->get_text( ).

CATCH cx_root INTO oref.

text = oref->get_text( ).



gs_functions = lr_table->get_functions( ).

*activate ALV generic Functions

gs_functions->set_all( 'X' ).

lr_table->display( ).

It is working fine.

Former Member
0 Kudos

Please check the data type of your field. Check whether it is not numc or char .

0 Kudos

the data type in the table is currency

Former Member
0 Kudos

Hi Smita,

In the output only those fields will have total option which has numeric data type.

So for your final internal table of that field, it has to be a numeric field. check the declaration.