‎2007 Mar 28 3:47 PM
Hello all,
I have used REUSE_ALV_GRID_DISPLAY in one of my ALV report. My requirement is to activate the Count functionality seen under
Edit -> Calculate -> Count
Right now this count is greyed out. How can we activate it?
Thanks
‎2007 Mar 28 3:53 PM
‎2007 Mar 28 6:07 PM
Folks,
I am still unable to figure this out.
Could someone help me out with this.
THanks
‎2007 Mar 28 6:09 PM
‎2007 Mar 28 6:10 PM
‎2007 Mar 28 6:13 PM
‎2007 Mar 28 6:19 PM
See this example, works good in my system.
REPORT zrich_0001.
* Global ALV Data Declarations
TYPE-POOLS: slis.
* Internal Tables
DATA: BEGIN OF ialv OCCURS 0,
test1(10) TYPE c,
test2(10) TYPE c,
count TYPE i, "<----- HERE
END OF ialv.
DATA: fieldcat TYPE slis_t_fieldcat_alv.
DATA: layout TYPE slis_layout_alv.
START-OF-SELECTION.
PERFORM get_data.
PERFORM call_alv.
*********************************************************************
* Form GET_DATA
*********************************************************************
FORM get_data.
ialv-test1 = 'ABC'.
ialv-test2 = 'DEF'.
ialv-count = '1'. "<----- HERE
APPEND ialv.
ialv-test1 = 'GHI'.
ialv-test2 = 'JKL'.
ialv-count = '1'. "<----- HERE
APPEND ialv.
ialv-test1 = '123'.
ialv-test2 = '456'.
ialv-count = '1'. "<----- HERE
APPEND ialv.
ENDFORM. "GET_DATA
************************************************************************
* CALL_ALV
************************************************************************
FORM call_alv.
PERFORM build_field_catalog.
layout-countfname = 'COUNT'. "<----- HERE
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = layout
it_fieldcat = fieldcat
TABLES
t_outtab = ialv.
ENDFORM. "CALL_ALV
************************************************************************
* BUILD_FIELD_CATALOG
************************************************************************
FORM build_field_catalog.
CLEAR: fieldcat. REFRESH: fieldcat.
DATA: tmp_fc TYPE slis_fieldcat_alv.
tmp_fc-reptext_ddic = 'Test1'.
tmp_fc-fieldname = 'TEST1'.
tmp_fc-tabname = 'IALV'.
tmp_fc-outputlen = '10'.
APPEND tmp_fc TO fieldcat.
tmp_fc-reptext_ddic = 'Test2'.
tmp_fc-fieldname = 'TEST2'.
tmp_fc-tabname = 'IALV'.
tmp_fc-outputlen = '10'.
APPEND tmp_fc TO fieldcat.
ENDFORM. "BUILD_FIELD_CATALOG
On the output, you can now choose the "Count" option from the menu.
Regards,
Rich HEilman
‎2007 Mar 28 6:20 PM
‎2007 Mar 28 6:47 PM
I tried your sample code. Initially we would see only two columns. Thats good. When I go with Count we will get Count column as extra (we see 3 columns now) and we see the count in the count column. Makes sense.
But what I was thinking is we would select any one column and press the count in menu and we would get the count in the same coulmn at the bottom. I don't know if this is possible. What do you think Rich?
I tried something like this earlier.
I have a MENGE column in the output which has sub totals. I gave MENGE to layout-countfname and I got the count properly but subtotals were missing in this column. So I think its not good to pass columns which have totals to layout-countfname as it may disturb the totals.
‎2007 Mar 28 6:51 PM
sounds like I have answered my own question in my last reply.
bottom line is I think your idea makes sense Rich. I gotto have a seperate column for count in order to not to disturb other columns.
do you have any other ideas other than this approach Rich?
‎2007 Mar 28 6:52 PM
‎2007 Mar 28 6:57 PM
I dont know I am waiting for more information from my functional guy. Earlier he just asked to activate the Count in menu. Thats how all this mess started.
Also, one more think what I observed is if you go wtih Count for the second time in your approach the count column disappears. So it is not a good idea to pass the actual internal table fields to layout-coutnfname as there is chance of them disappearing.
Your earlier approach with seperate column for Count makes more sense to me.
‎2007 Mar 28 6:58 PM
‎2008 May 30 1:24 PM
I have a requirement for the same functionality
I have a report which shows the employee absences for a month
so you have an alv with in every row an employee number and in the colums all the days of a month
every day can be filled with nothing, an absence or workschedule parameter
now an projectmanager sees the list and wants to know how many employees are available on a certain day and how many are absent.
If I can use count as the requirment is also above then the column would seperate all the possibilities
like
10 available
5 abscent
2 ill
still looking for a solution
kind regards
arthur de smidt
‎2010 Feb 09 11:06 PM
I followed Rich's advice above and this worked perfectly for me. It was the solution I was looking for.
Thanks for the help Rich!
Regards,
Robin.