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

alv % total

Former Member
0 Likes
1,553

hi all,

i have a field , field , field in alv grid .

field3 = ( field1 / field2 ) * 100 .

i need to display the field3 sum ???? any thoughts ??

9 REPLIES 9
Read only

Former Member
0 Likes
1,507

What would you like to do? Should the end-user be able to perform the calculation or do want to program it in your ABAP?

Regards,

Dick Krijger

Read only

0 Likes
1,507

i can calculate the avg in abap , i do not know how to modify the results line ??

anyways when i set the display-totals , the sum should be displayed ..???

Read only

0 Likes
1,507

Hi Shiv,

I have certain questions, if you can answer, them probably the picture might get clearer.

a) When you click on the sum(sigma) button, for column field3, are you getting a total, or are you getting a message in the status bar saying "Totals available only for integer values".

b) What is type of field3 ? Have you specified any type for field3 ? Have you use the <b>INTTYPE</b> or <b>DATATYPE</b> fields for that entry of fieldcatalog(field3) ?

For grid related issues, there is an excellent tutorial available from Serdar. You may refer that.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an easy reference for alv grid control.pdf

Regards,

Subramanian V.

Read only

0 Likes
1,507

i made that field as char, so that i can display totals ,

if i hit sum , it will literally diplays SUM(in which case it's wrong..coz my sum is sum/no of rows(avg)..as i said i can calculate the avg in abap ,but how to display it in grid ??

when you hit sum , end of the report ...i want to modify the final Line(display line--yellow line). i tried EVENT BEFORE_LINE_OUTPUT ,for some reason it's not working...any help will be greatly appreciated.

Regards,

shiv

Read only

0 Likes
1,507

sorry i said CHAR, but it's a CURR field

Shiv.

Read only

0 Likes
1,507

Hi Shiv,

What you have to do is in the field catalog set DO_SUM to 'X' for the field3 and for others set it as blank. This will solve your problem.

Before you are calling the output before that you can do the calculation.

In case if you want to use BEFORE_LINE_OUTPUT. There are function modules that you have to call for refreshing the same at the output screen.

REUSE_ALV_GRID_LAYOUT_INFO_SET - For Grid

REUSE_ALV_LIST_LAYOUT_INFO_SET - For List

But I doubt if you will be able to use BEFORE_LINE_OUTPUT event with GRID display.

regards,

Satya

Read only

0 Likes
1,507

I have the same problem in one of my ALV reports. I also calculate a percentage ((field1/field2) * 100) and show this field on each row. However, my sub-total value cannot just be summed up like suggested but needs to be calculated on sub-total and grand-total level again. Thus, the do_sum nor the Sigma icon would work.

Further is there an option on sub-total and grand-total level that allows me to average the field values?

Just for your information all my fields are type p with 2 decimals

Read only

Former Member
0 Likes
1,507

Hi Abap Gurus,

in my catalog i hv marked field with do_sum = 'x'.

But then also i dont get total in alv display.

Wht shld be the data types of field, if v want to show its total in ALV. My fields has type Curr 15...

Suggestion are welcome....

Read only

0 Likes
1,507

Hi, can you put your code here, i'll try to find something wrong, ok?