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: 

Displaying Average of Columns in ALV Blocked List Display

Former Member
0 Kudos

Hi,

I am using ALV Blocked List Display. For the 1st block, I need to display the average of certain columns.

I am using the following code in the field catalog of the RATE column to display the average , but it is not displayed.

wa_disptab_field-col_pos = 8.

wa_disptab_field-fieldname = 'RATE''.

wa_disptab_field-ref_tabname = 'IT_DISPTAB'.

wa_disptab_field-seltext_m = 'RS PER KL'.

wa_disptab_field-do_sum = 'C'.

wa_disptab_field-datatype = 'QUAN'.

append wa_disptab_field to it_disptab_field.

clear wa_disptab_field.

For the same column, the sum is displayed with the same code if I change this part:

wa_disptab_field-do_sum = 'C'. To wa_disptab_field-do_sum = 'X'.

Please Help..

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Indeed, it looks like there is something wrong with average in BLOCK ALV... It's working fine with normal grids however... can't you use CL_GUI_ALV_GRID with three containers instead?

Anyway, I'll get back if I found what's wrong with the BLOCK list...

Kr,

m.

4 REPLIES 4

Former Member
0 Kudos

Hi,

Indeed, it looks like there is something wrong with average in BLOCK ALV... It's working fine with normal grids however... can't you use CL_GUI_ALV_GRID with three containers instead?

Anyway, I'll get back if I found what's wrong with the BLOCK list...

Kr,

m.

Former Member
0 Kudos

Hi debarati ,

declare in global :

gt_sort TYPE slis_t_sortinfo_alv,

gs_sort TYPE slis_sortinfo_alv.

In field catalog ,add another lines i.e

wa_disptab_field-col_pos = 8.

wa_disptab_field-fieldname = 'RATE''.

wa_disptab_field-ref_tabname = 'IT_DISPTAB'.

wa_disptab_field-seltext_m = 'RS PER KL'.

wa_disptab_field-do_sum = 'C'.

wa_disptab_field-datatype = 'QUAN'.

wa_distab-do_sum = 'X'.

append wa_disptab_field to it_disptab_field.

clear wa_disptab_field.

And this in field catlog:

below

gs_sort-fieldname = 'RATE'.

gs_sort-tabname = 'T_DISPTAB' "Final Internal table

gs_sort-subtot = 'X'.

APPEND gs_sort TO gt_sort.

I hope this would workout.

Thanks & Regards,

Abhisek.

0 Kudos

Hi Abhishek,

I have tried using gt_sort , but still it is not working.

I am also in a doubt if at all column average is possible in ALV Blocked List Display...

Thankss neway........

0 Kudos

Hi Debarati,

go For function/pattern [reuse_alv_grid_display_lvc]

do the following as mentioned in the previous reply's.

And To find the Average of your requirement, pass the field names as per the requirement.

gs_sort-fieldname = 'RATE'.

gs_sort-tabname = 'T_DISPTAB' "Final Internal table

gs_sort-subtot = 'X'.

APPEND gs_sort TO gt_sort.

gs_sort-fieldname = 'RATE1'.

gs_sort-tabname = 'T_DISPTAB' "Final Internal table

gs_sort-subtot = 'X'.

APPEND gs_sort TO gt_sort.

gs_sort-fieldname = 'RATE2'.

gs_sort-tabname = 'T_DISPTAB' "Final Internal table

gs_sort-subtot = 'X'.

APPEND gs_sort TO gt_sort.

gs_sort-fieldname = 'RATE3'.

gs_sort-tabname = 'T_DISPTAB' "Final Internal table

gs_sort-subtot = 'X'.

APPEND gs_sort TO gt_sort.

CALL FUNCTION ' REUSE_ALV_GRID_DISPLAY_lvc'

EXPORTING

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND'

is_layout = gs_layout

it_fieldcat = wa_disptab

it_events = gt_events

it_sort = gt_sort

i_default = 'X'

i_save = 'U'

TABLES

t_outtab = gt_final

EXCEPTIONS

program_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

i think this will workout.

Thanks & Regards,

Abhisek

Edited by: Abhisek Pradhan on Sep 29, 2011 7:55 PM