2007 Jun 15 3:03 AM
i used CL_GUI_ALV_GRID>->set_table_for_first_display
to display alv
but why the subtotal and total button are gray in the toolbar.
i searched the help, but there is no parameter to adjust the layout.
who met such problem, please give me a favor
thank u in advance
Kevin
i used CL_GUI_ALV_GRID>->set_table_for_first_display
to display alv
but why the subtotal and total button are gray in the toolbar.
i searched the help, but there is no parameter to adjust the layout.
who met such problem, please give me a favor
thank u in advance
Kevin
2007 Jun 15 3:10 AM
Hi,
In the field catalog field in which field you want to make sum to be populate with
i_fieldcat-do_sum = 'X'.
aRs
2007 Jun 15 3:18 AM
2007 Jun 15 3:24 AM
Have you populate the field catalog DO_SUM" against field you want to total?
if you done, button will get enabled
aRs
2007 Jun 15 3:29 AM
Hello, aRs,
thanks for your quick reply.
would u please give some sample code
thank u,
2007 Jun 15 3:36 AM
Hi,
it is not calculated in the class but you pass some values to the grid in the field catalogue like this:
CALL METHOD mygrid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = t_fcodes[]
CHANGING
it_outtab = mytable[]
it_fieldcatalog = field_catal[].
for your field catalogue you can fill the table so
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = field_catal.
field_catal is of type lvc_t_fcat and this one has among others fields DO_SUM.
For example:if you want to sum airline fare
field_catal-fieldname = 'FARE'
field_catal-do_sum = 'X'.
modify field_catal.
aRs
2007 Jun 15 3:42 AM
Add Default Sorting to ALVgrid report
In order to display an ALV report with specific columns already sorted by default you will need to build a
sort catalogue. This is fairly straight forward and is done in the following way:
Step 1. Add data declaration for sort catalogue
Step 2. Add code to build sort catalogue table
Step 3. Update 'gd_tree->set_table_for_first_display' method call to include parameter 'it_sort'
* ALV data declarations
data: it_sortcat type LVC_T_SORT,
it_sortcatdb type LVC_T_SORT.
perform build_sortcat.
*&------------------------------------------------------------------*
*& Form build_sortcat
*&------------------------------------------------------------------*
* Build Sort catalog
*-------------------------------------------------------------------*
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
ENDFORM. " build_sortcat
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_layout = gd_layout
CHANGING
it_fieldcatalog = gd_fieldcat
it_sort = it_sortcat
it_outtab = it_report.
rewaard points if it is usefull ...
Girish
2007 Jun 15 6:37 AM
why the button is gray, i mean i cannot use the button of subtotal & total.
2007 Jun 15 8:36 AM
the button of subtotal & total & average can not be used, always is gray
Why???
2007 Jun 15 4:50 PM
the problem have been sloved.
the field u wanna total or sutotal shouldnot be defined into Char' type.
2007 Jun 15 4:51 PM
the problem have been sloved.
the field u wanna total or sutotal shouldnot be defined into Char' type.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |