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

set_table_for_first_display SUBTOTAL button grayed out

Former Member
0 Likes
2,674

Hello all,

Method "set_table_for_first_display" of class "cl_gui_alv_grid" is displaying the SUBTOTAL icon grayed out. Initially I was excluding the button. But after commenting out the exclude logic, the button displayed but is not active.

What do i need to changed to allow that button to be pressed?

Thanks

Bruce

w_grid TYPE REF TO cl_gui_alv_grid, " ALV grid object

DATA ls_exclude TYPE ui_func.

  • prevent display of the following icons on the ALV toolbar

*

  • ls_exclude = cl_gui_alv_grid=>mc_mb_subtot. " SUBTOTAL

  • append ls_exclude to pt_exclude.

*

CALL METHOD w_grid->set_table_for_first_display

EXPORTING

i_bypassing_buffer = 'X'

is_layout = l_layout

it_toolbar_excluding = lt_exclude

CHANGING

it_fieldcatalog = il_fieldcat

it_outtab = il_outtab.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,930

1) Create a Table of Type LVC_T_SORT -->T_sort

2) Field string of type LVC_S_SORT--->Fs_sort

Pass:

FS_sort-Fieldname = <Numceric Field>.

FS_SORT-SUBTOT = 'X'.

Append fs_sort to t_sort.

3) Pass the table to CALL METHOD w_grid->set_table_for_first_display

Regards,

Gurpreet

8 REPLIES 8
Read only

former_member242255
Active Contributor
0 Likes
1,930

remove the below passing parameter

it_toolbar_excluding = lt_exclude to the call of the method..set_for)first_diaply..

and check...

Edited by: Sravan Kumar on May 8, 2009 6:33 AM

Read only

0 Likes
1,930

Sravan,

Removing exclude table from the method did not change the SUBTOTAL icon. It is still grayed out.

Thanks

Bruce

Read only

Former Member
0 Likes
1,931

1) Create a Table of Type LVC_T_SORT -->T_sort

2) Field string of type LVC_S_SORT--->Fs_sort

Pass:

FS_sort-Fieldname = <Numceric Field>.

FS_SORT-SUBTOT = 'X'.

Append fs_sort to t_sort.

3) Pass the table to CALL METHOD w_grid->set_table_for_first_display

Regards,

Gurpreet

Read only

0 Likes
1,930

Gurpreet,

After adding your code suggestion, the SUBTOTAL icon is still grayed out.

Thanks

Bruce

Read only

0 Likes
1,930

Hi Bruce, try clicking the "total" button first. The subtotal button should then be active. If you want the subtotal button to be active by default, you must set the alv grid to total any of the numeric fields on first display.

Regard,

Rich Heilman

Read only

0 Likes
1,930

BTW, to set the totaling for a column use the DO_SUM field in the field catalog.

clear: ls_fcat.
  ls_fcat-reptext    = 'Est. Hrs'.
  ls_fcat-coltext    = 'Est. Hrs'.
  ls_fcat-fieldname  = 'ESHRS'.
  ls_fcat-ref_table  = 'I_ALV'.
  ls_fcat-datatype   = 'QUAN'.
  ls_fcat-do_sum     = 'X'.      "<--- SEt this flag
  ls_fcat-just       = 'R'.
  ls_fcat-outputlen  = '10'.
  ls_fcat-col_pos    = 7.
  append ls_fcat to fieldcat.

Regards,

Rich Heilman

Read only

0 Likes
1,930

Rich,

Your two suggestions worked flawlessly.

I have another related question.

When the subtotal dialog displays, three options are displayed, sort ascending, sort descending, and subtotal.

When executing tcode FS10N, a fourth option, countrol break also displays.

How do I get the control break option to display in my program when the subtotal dialog displays?

Thanks

Bruce

Read only

Former Member
0 Likes
1,930

The question was answered correctly, but I wanted to ask a follow-up question. I thought my follow-up question would be more likely to be looked at and answered if the question was still marked as unanswered.

Bruce