2012 Feb 20 10:22 AM
Hi all
Hi all
i search a way to set a subtotal titel, i sum lines, if i see the subtotal i would like to have on the "yellow" line also the material text because if i would see only the subtotal lines. Problem now i don't know with Material is it .
For example my code what could i to to set the subtotal titel ?
thanks in advance
DATA: gr_table TYPE REF TO cl_salv_table,
gr_functions TYPE REF TO cl_salv_functions,
gr_layout TYPE REF TO cl_salv_layout,
gr_column TYPE REF TO cl_salv_column_table,
gr_columns TYPE REF TO cl_salv_columns_table,
gr_display TYPE REF TO cl_salv_display_settings,
gr_selections TYPE REF TO cl_salv_selections,
gr_agg TYPE REF TO cl_salv_aggregations,
gr_sorts TYPE REF TO cl_salv_sorts,
key TYPE salv_s_layout_key VALUE sy-repid.
"Required------------------------------------------------
*&--Display the ALV
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table CHANGING t_table = it_mseg_mat ).
"Optional------------------------------------------------
*---Setting the ALV toolbar
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
*---Setting the Layout Save property
gr_layout = gr_table->get_layout( ).
gr_layout->set_key( key ).
gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
*---Setting the list header
gr_display = gr_table->get_display_settings( ).
gr_display->set_list_header( header ).
"Optional------------------------------------------------
*---Setting the Columns/Layout
gr_columns = gr_table->get_columns( ).
gr_columns->set_key_fixation( abap_true ).
gr_columns->set_color_column( 'COLOR' ).
*---Setting the key columns
gr_column ?= gr_columns->get_column( 'EBELN' ).
gr_column->set_key( if_salv_c_bool_sap=>true ).
*---Setting the Selection mode
gr_selections = gr_table->get_selections( ).
gr_selections->set_selection_mode( 1 ).
*---Setting the Aggregate/Sum columns
gr_agg = gr_table->get_aggregations( ).
gr_agg->add_aggregation( 'MENGE' ).
*---Sort
gr_sorts = gr_table->get_sorts( ).
gr_sorts->add_sort( columnname = 'EBELN' subtotal = abap_true sequence =
if_salv_c_sort=>sort_up ).
gr_sorts->add_sort( columnname = 'MATNR' ).
gr_sorts->set_position( columnname = 'EBELN' position = 1 ).
gr_sorts->set_position( columnname = 'MATNR' position = 2 ).
*---??????
Subtotal titel for the line of MENGE ( material text )
"Required------------------------------------------------
*---Displaying the ALV
gr_table->display( ).
Hi all
Hi all
i search a way to set a subtotal titel, i sum lines, if i see the subtotal i would like to have on the "yellow" line also the material text because if i would see only the subtotal lines. Problem now i don't know with Material is it .
For example my code what could i to to set the subtotal titel ?
thanks in advance
DATA: gr_table TYPE REF TO cl_salv_table,
gr_functions TYPE REF TO cl_salv_functions,
gr_layout TYPE REF TO cl_salv_layout,
gr_column TYPE REF TO cl_salv_column_table,
gr_columns TYPE REF TO cl_salv_columns_table,
gr_display TYPE REF TO cl_salv_display_settings,
gr_selections TYPE REF TO cl_salv_selections,
gr_agg TYPE REF TO cl_salv_aggregations,
gr_sorts TYPE REF TO cl_salv_sorts,
key TYPE salv_s_layout_key VALUE sy-repid.
"Required------------------------------------------------
*&--Display the ALV
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table CHANGING t_table = it_mseg_mat ).
"Optional------------------------------------------------
*---Setting the ALV toolbar
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
*---Setting the Layout Save property
gr_layout = gr_table->get_layout( ).
gr_layout->set_key( key ).
gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
*---Setting the list header
gr_display = gr_table->get_display_settings( ).
gr_display->set_list_header( header ).
"Optional------------------------------------------------
*---Setting the Columns/Layout
gr_columns = gr_table->get_columns( ).
gr_columns->set_key_fixation( abap_true ).
gr_columns->set_color_column( 'COLOR' ).
*---Setting the key columns
gr_column ?= gr_columns->get_column( 'EBELN' ).
gr_column->set_key( if_salv_c_bool_sap=>true ).
*---Setting the Selection mode
gr_selections = gr_table->get_selections( ).
gr_selections->set_selection_mode( 1 ).
*---Setting the Aggregate/Sum columns
gr_agg = gr_table->get_aggregations( ).
gr_agg->add_aggregation( 'MENGE' ).
*---Sort
gr_sorts = gr_table->get_sorts( ).
gr_sorts->add_sort( columnname = 'EBELN' subtotal = abap_true sequence =
if_salv_c_sort=>sort_up ).
gr_sorts->add_sort( columnname = 'MATNR' ).
gr_sorts->set_position( columnname = 'EBELN' position = 1 ).
gr_sorts->set_position( columnname = 'MATNR' position = 2 ).
*---??????
Subtotal titel for the line of MENGE ( material text )
"Required------------------------------------------------
*---Displaying the ALV
gr_table->display( ).
2012 Feb 20 10:26 AM
2012 Feb 20 10:30 AM
Hi
i don't use 'REUSE_ALV_GRID_DISPLAY' -> cl_salv_table and for these i search a way
2012 Feb 20 10:39 AM
Hi
May be this helps
http://wiki.sdn.sap.com/wiki/display/ABAP/ALVGridReport-withObjectOrientedSALVClasses
2012 Feb 20 11:13 AM
2012 Feb 20 11:41 AM
Hi,
Your question is not much clear. Is it like you have sort on PO no & Material but in subtotal line you need the material description ?
FYI.
SALV doesn't support Custom Subtotal Texts. You have a look into this thread for a work around
2012 Feb 20 10:46 AM