2004 Dec 14 8:27 PM
hi all,
i have a field , field , field in alv grid .
field3 = ( field1 / field2 ) * 100 .
i need to display the field3 sum ???? any thoughts ??
2004 Dec 14 8:32 PM
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
2004 Dec 14 8:43 PM
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 ..???
2004 Dec 15 4:00 AM
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.
2004 Dec 15 2:34 PM
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
2004 Dec 15 2:37 PM
2004 Dec 15 2:47 PM
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
2004 Dec 15 7:05 PM
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
2005 Feb 25 6:29 AM
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....
2006 Jun 01 12:37 PM
Hi, can you put your code here, i'll try to find something wrong, ok?