Total and Subtotal for set_table_for_first_display

Hello,
I am displaying data in ALV by using set_table_for_first_display , i want to do_sum  for
10-15 columns starting from the column index 11.. and i have also passed the value in internal table of type LVC_T_SORT and in the fieldcatlog this fields are checked for DO_SUM but sum is not coming in the final output even summation button is disabled and subtotal is also getting reflected.
Is it i need to do extra to do this when i am displaying data by using the OOPS methos?
Please sugggest what could be the reason..
Thanks
Prince

Hi,
Try the below code.
TABLES: mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
types: begin of ty_marc,
         matnr type marc-matnr,
         werks type marc-werks,
         count type i,
       end of ty_marc.
data: it_marc type standard table of ty_marc with header line.
START-OF-SELECTION.
  SELECT matnr werks FROM marc INTO TABLE it_marc WHERE matnr IN s_matnr and werks in ('0888', '0811').
  loop at it_marc.
    it_marc-count = 1.
    modify it_marc transporting count.
  endloop.
"* Definition for Object Oriented ALV
  DATA: gr_table      TYPE REF TO cl_salv_table.
  DATA: gr_sorts      TYPE REF TO cl_salv_sorts.
  DATA: gr_agg        TYPE REF TO cl_salv_aggregations.
  DATA: gr_agg2       TYPE REF TO cl_salv_aggregation.
  DATA: gr_display    TYPE REF TO cl_salv_display_settings.
  DATA: gr_layout     TYPE REF TO cl_salv_layout.
  DATA: ls_key        TYPE salv_s_layout_key.
"* Display ALV as a Grid
  TRY.
      cl_salv_table=>factory( IMPORTING r_salv_table = gr_table
                              CHANGING  t_table      = it_marc[] ).
    CATCH cx_salv_msg.
  ENDTRY.
    TRY.
        gr_agg = gr_table->get_aggregations( ).
        CALL METHOD gr_agg->add_aggregation
          EXPORTING
            columnname  = 'COUNT'
            aggregation = if_salv_c_aggregation=>total
          RECEIVING
            value       = gr_agg2.
      CATCH cx_salv_data_error .
      CATCH cx_salv_not_found .
      CATCH cx_salv_existing .
    ENDTRY.
"* Set up Sorts
    TRY.
        gr_sorts = gr_table->get_sorts( ).
        CALL METHOD gr_sorts->add_sort
          EXPORTING
            columnname = 'MATNR'
            position   = 1
            sequence   = if_salv_c_sort=>sort_up
            subtotal   = if_salv_c_bool_sap=>true
            group      = if_salv_c_sort=>group_none
            obligatory = if_salv_c_bool_sap=>false.
      CATCH cx_salv_data_error .
      CATCH cx_salv_not_found .
      CATCH cx_salv_existing .
    ENDTRY.
"* Add layout variants in report
    TRY.
      gr_layout = gr_table->get_layout( ).
"*... set the Layout Key
      ls_key-report = sy-repid.
      gr_layout->set_key( ls_key ).
"*... set usage of default Layouts
      gr_layout->set_default( abap_true ).
"*... set Layout save restriction
      gr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
    ENDTRY.
    TRY.
"* Display ALV
      gr_table->display( ).
    ENDTRY.
Hope it helps.
Thanks,
Balaji

Similar Messages

  • ALV Grid Control -  Modifiy data in total and subtotal lines

    Hello all,
    I´am creating a report using ALV Grid Control. This report calculates (using delivered and returned materials) for each vendor/material-combination the return quote.
    Using the totals and subtotals function for different characteristics I want to calculate the return quote for the selected characteristic. Example:
    Material delivered returned quote
    ..4711 . . . 500 . . . 5 . . . . 1 (=returned*100/delivered)
    ..4711 . . . 400 . . . 10 . . . . 2,5
    . SUM . . . 900 . . . 15 . . . . 3,5 <-- 3,5 is the sum but I want display the calculated value 1,667
    Is there a possibility to modify data in the total and subtotal lines.
    Thank you for your answer
    Best regards
    Thomas

    you said instead of 3.5 you want to show 1,667 ..
    how is it possible...
    3,5 become 1,667
    i thought you are doing any conversions...
    vijay

  • Field over flow can not display the total and subtotal in ALV

    hi
    i am running a z report with huge data in quality system.
    in 2 columns and not able to show the total and subtotal in 2 columns
    it says field overflow and cannot be dispayed.
    value is around 20character integer.

    You can create a domains with 20 positions and 2 decimal, for example.
    Than, associate this domain a data element.
    To finish assign that data element to the column you wanna sum.
    I hope help.

  • Change the total and subtotal dynamically in ALV GRID

    Hi guys,
               I need to change the total and subtotal of field "AMOUNT" dynamically.I am using ALV GRID CONTROL(oops concept).I need to override the standard functionality.I need to show my own subtotal and total line instead of standard one .

    Hi
    I've understood it, I wanted to use OO Grid too, but I had to use the ALV list in order to write my total.
    If you need to use OO grid u can try to exclude all funcitonalities for the total, subtotal and sorting and insert in the output table the lines with your totals.
    Max

  • Total and subtotal in alv

    hi,
    i have an ALV REPORT,displaying the fields such as po item(ekpo-menge).the data type is qunt.
    but i am unable to perform total and sub total,it gives me a information message 'total cannot b performed'.
      even i tried with  X_FIELDCAT-DO_SUM = 'X',
    can any one help me, how to total and subtotal.

    HI
    GOOD
    CHECK WITH THIS EXAMPLES
    data: begin of output_tab occurs 0,
           total_field_hidden(1) type c,
           sortfield1(3) type c,
           sortfield1_hidden(3) type c,
           numerator type p,
           denominator type p,
           perc type p decimals 2,
           percentage type p decimals 2, "(7) type c,
         end of output_tab.
    data: abaplist type standard table of abaplist.
    type-pools: slis.
    data: g_repid like sy-repid.
    data: gt_events type slis_t_event.
    parameters: p_grid radiobutton group g1,
               p_list radiobutton group g1.
    initialization.
    *This is necessary so that the ALV_GRID knows where to
    find the form
    g_repid = sy-repid.
    start-of-selection.
    perform fill_output_tab.
    perform output_alv.
    *&      Form  FILL_OUTPUT_TAB
    form fill_output_tab.
    output_tab-total_field_hidden = '1'.
    output_tab-sortfield1 = output_tab-sortfield1_hidden
    = 'AAA'.
    output_tab-numerator  = 1.
    output_tab-denominator = 2.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 3.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 5.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 5.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-sortfield1 = output_tab-sortfield1_hidden
    = 'BBB'.
    output_tab-numerator  = 1.
    output_tab-denominator = 2.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 2.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 3.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 5.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    endform.                    " FILL_OUTPUT_TAB
    *&      Form  output_alv
    output the list in an ALV Grid
    form output_alv.
    data: ls_layo    type slis_layout_alv,
           lt_fcat    type slis_t_fieldcat_alv,
           lt_sort    type slis_t_sortinfo_alv.
    perform f01_set_sort changing lt_sort.
    perform f01_set_layo changing ls_layo.
    perform f01_set_fcat changing lt_fcat.
    perform eventtab_build using gt_events[].
    g_repid = sy-repid.
    clear output_tab.
    case 'X'.
       when p_list.
         call function 'REUSE_ALV_LIST_DISPLAY'
              exporting
                   I_INTERFACE_CHECK = 'X'
                   i_callback_program = g_repid
                   is_layout          = ls_layo
                   it_fieldcat        = lt_fcat
                   it_events          = gt_events[]
                   it_sort            = lt_sort
              tables
                   t_outtab           = output_tab
              exceptions
                   program_error      = 1
                   others             = 2.
       when p_grid.
         call function 'REUSE_ALV_GRID_DISPLAY'
              exporting
                   i_callback_program = g_repid
                   is_layout          = ls_layo
                   it_fieldcat        = lt_fcat
                   it_events          = gt_events[]
                   it_sort            = lt_sort
              tables
                   t_outtab           = output_tab
              exceptions
                   program_error      = 1
                   others             = 2.
    endcase.
    endform.                    " output_alv
    Sets the Events the ALV Grid needs to react to for
    the Overall Output.
         -->RT_EVENTS[]  A table of events and the forms
    that must be
                         performed for each one.
    form eventtab_build using rt_events type slis_t_event.
    *"Registration of events to happen during list display
    data: ls_event type slis_alv_event.
    refresh rt_events.
    call function 'REUSE_ALV_EVENTS_GET'
          exporting
               i_list_type = 0
          importing
               et_events   = rt_events.
    Subtotal
    read table rt_events with key name =
    slis_ev_subtotal_text
                              into ls_event.
    if sy-subrc = 0.
       move 'SUBTOTAL_TEXT' to ls_event-form.
       append ls_event to rt_events.
    endif.
    endform.                    " EVENTTAB_BUILD2
    *&      Form  f01_set_sort
    form f01_set_sort changing p_lt_sort type
    slis_t_sortinfo_alv.
    data: ls_sort type slis_sortinfo_alv.
    clear ls_sort.
    ls_sort-spos = 1.
    ls_sort-fieldname = 'TOTAL_FIELD_HIDDEN'.
    ls_sort-subtot = 'X'.
    append ls_sort to p_lt_sort.
    clear ls_sort.
    ls_sort-spos = 2.
    ls_sort-fieldname = 'SORTFIELD1_HIDDEN'.
    ls_sort-subtot = 'X'.
    append ls_sort to p_lt_sort.
    endform.                    " f01_set_sort
    *&      Form  f01_set_layo
    Sets layout options
    form f01_set_layo changing p_ls_layo type
    slis_layout_alv.
    p_ls_layo-no_totalline = 'X'.
    endform.                    " f01_set_layo
    *&      Form  f01_set_fcat
          Sets the columns and texts for the ALV Grid
         <--P_LT_FCAT  text
    form f01_set_fcat changing ct_fcat type
    slis_t_fieldcat_alv.
    data: ls_fcat type slis_fieldcat_alv.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'TOTAL_FIELD_HIDDEN'.
    ls_fcat-no_out = 'X'.
    ls_fcat-col_pos       = 1.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'SORTFIELD1_HIDDEN'.
    ls_fcat-no_out = 'X'.
    ls_fcat-col_pos       = 2.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'SORT'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'SORTFIELD1'.
    ls_fcat-col_pos       = 3.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'SALES'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'NUMERATOR'.
    ls_fcat-col_pos       = 4.
    ls_fcat-datatype = 'CURR'.
    ls_fcat-do_sum = 'X'.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'COST'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'DENOMINATOR'.
    ls_fcat-datatype = 'CURR'.
    ls_fcat-col_pos       = 5.
    ls_fcat-do_sum = 'X'.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'MARGIN'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'PERCENTAGE'.
    ls_fcat-datatype = 'CHAR'.
    ls_fcat-do_sum = 'X'.
    ls_fcat-col_pos       = 6.
    append ls_fcat to ct_fcat.
    endform.
    *&      Form  subtotal_text
    Manipulate the subtotal line in the ALV to
    recalculate eficiency at
    total level.
    form subtotal_text using ep_subtot_line like
    output_tab
                            es_subtottxt type
    slis_subtot_text.
    if es_subtottxt-criteria = 'TOTAL_FIELD_HIDDEN'.
       es_subtottxt-display_text_for_subtotal = 'Final
    Total'.
    endif.
    ep_subtot_line-percentage = ep_subtot_line-numerator
                / ep_subtot_line-denominator
    100.
    ep_subtot_line-perc = ep_subtot_line-percentage.
    endform.
           total_field_hidden(1) type c,
    >        sortfield1(3) type c,
    >        sortfield1_hidden(3) type c,
    >        numerator type p,
    >        denominator type p,
    >        perc type p decimals 2,
    >        percentage type p decimals 2, "(7) type c, end of output_tab.
    >
    >data: abaplist type standard table of abaplist.
    >
    >type-pools: slis.
    >data: g_repid like sy-repid.
    >data: gt_events type slis_t_event.
    >*----
    >parameters: p_grid radiobutton group g1,
    >            p_list radiobutton group g1.
    >
    >initialization.
    >*This is necessary so that the ALV_GRID knows where to
    >find the form
    >  g_repid = sy-repid.
    >
    >start-of-selection.
    >  perform fill_output_tab.
    >
    >  perform output_alv. &---- *&      Form  FILL_OUTPUT_TAB &---- form fill_output_tab.
    >  output_tab-total_field_hidden = '1'.
    >  output_tab-sortfield1 = output_tab-sortfield1_hidden = 'AAA'.
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 2.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 3.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 5.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 5.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-sortfield1 = output_tab-sortfield1_hidden = 'BBB'.
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 2.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 2.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 3.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 5.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >endform.                    " FILL_OUTPUT_TAB
    >&----
    >*&      Form  output_alv
    >&----
    >* output the list in an ALV Grid
    >----
    >form output_alv.
    >  data: ls_layo    type slis_layout_alv,
    >        lt_fcat    type slis_t_fieldcat_alv,
    >        lt_sort    type slis_t_sortinfo_alv.
    >
    >  perform f01_set_sort changing lt_sort.
    >  perform f01_set_layo changing ls_layo.
    >  perform f01_set_fcat changing lt_fcat.
    >  perform eventtab_build using gt_events[].
    >  g_repid = sy-repid.
    >  clear output_tab.
    >  case 'X'.
    >    when p_list.
    >      call function 'REUSE_ALV_LIST_DISPLAY'
    >           exporting *                I_INTERFACE_CHECK = 'X'
    >                i_callback_program = g_repid
    >                is_layout          = ls_layo
    >                it_fieldcat        = lt_fcat
    >                it_events          = gt_events[]
    >                it_sort            = lt_sort tables
    >                t_outtab           = output_tab exceptions
    >                program_error      = 1
    >                others             = 2. when p_grid. call function 'REUSE_ALV_GRID_DISPLAY' exporting
    >                i_callback_program = g_repid
    >                is_layout          = ls_layo
    >                it_fieldcat        = lt_fcat
    >                it_events          = gt_events[]
    >                it_sort            = lt_sort tables
    >                t_outtab           = output_tab exceptions
    >                program_error      = 1
    >                others             = 2. endcase.
    >
    >endform.                    " output_alv
    >
    >&----
    >* Sets the Events the ALV Grid needs to react to for
    >the Overall Output.
    >----
    >*      -->RT_EVENTS[]  A table of events and the forms
    >that must be
    >*                      performed for each one.
    >----
    >form eventtab_build using rt_events type slis_t_event.
    >*"Registration of events to happen during list display
    >  data: ls_event type slis_alv_event.
    >*
    >  refresh rt_events.
    >  call function 'REUSE_ALV_EVENTS_GET'
    >       exporting
    >            i_list_type = 0 importing
    >            et_events   = rt_events.
    >
    >* Subtotal
    >  read table rt_events with key name = slis_ev_subtotal_text
    >                           into ls_event. if sy-subrc = 0. move 'SUBTOTAL_TEXT' to ls_event-form. append ls_event to rt_events. endif.
    >
    >endform.                    " EVENTTAB_BUILD2
    >&----
    >*&      Form  f01_set_sort
    >&----
    >form f01_set_sort changing p_lt_sort type
    >slis_t_sortinfo_alv.
    >
    >  data: ls_sort type slis_sortinfo_alv.
    >
    >  clear ls_sort.
    >  ls_sort-spos = 1.
    >  ls_sort-fieldname = 'TOTAL_FIELD_HIDDEN'.
    >  ls_sort-subtot = 'X'.
    >  append ls_sort to p_lt_sort.
    >
    >  clear ls_sort.
    >  ls_sort-spos = 2.
    >  ls_sort-fieldname = 'SORTFIELD1_HIDDEN'.
    >  ls_sort-subtot = 'X'.
    >  append ls_sort to p_lt_sort.
    >
    >endform.                    " f01_set_sort
    >&----
    >*&      Form  f01_set_layo
    >&----
    >* Sets layout options
    >----
    >form f01_set_layo changing p_ls_layo type
    >slis_layout_alv.
    >
    >  p_ls_layo-no_totalline = 'X'.
    >
    >endform.                    " f01_set_layo
    >&----
    >*&      Form  f01_set_fcat
    >&----
    >*       Sets the columns and texts for the ALV Grid
    >----
    >*      <--P_LT_FCAT  text
    >----
    >form f01_set_fcat changing ct_fcat type
    >slis_t_fieldcat_alv.
    >
    >  data: ls_fcat type slis_fieldcat_alv.
    >
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'TOTAL_FIELD_HIDDEN'.
    >  ls_fcat-no_out = 'X'.
    >  ls_fcat-col_pos       = 1.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'SORTFIELD1_HIDDEN'.
    >  ls_fcat-no_out = 'X'.
    >  ls_fcat-col_pos       = 2.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'SORT'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'SORTFIELD1'.
    >  ls_fcat-col_pos       = 3.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'SALES'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'NUMERATOR'.
    >  ls_fcat-col_pos       = 4.
    >  ls_fcat-datatype = 'CURR'.
    >  ls_fcat-do_sum = 'X'.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'COST'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'DENOMINATOR'.
    >  ls_fcat-datatype = 'CURR'.
    >  ls_fcat-col_pos       = 5.
    >  ls_fcat-do_sum = 'X'.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'MARGIN'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'PERCENTAGE'. *  ls_fcat-datatype = 'CHAR'.
    >  ls_fcat-do_sum = 'X'.
    >  ls_fcat-col_pos       = 6.
    >  append ls_fcat to ct_fcat.
    >
    >endform.
    >&----
    >*&      Form  subtotal_text
    >&----
    >* Manipulate the subtotal line in the ALV to
    >recalculate eficiency at
    >* total level.
    >----
    >form subtotal_text using ep_subtot_line like
    >output_tab
    >                         es_subtottxt type slis_subtot_text.
    >
    >  if es_subtottxt-criteria = 'TOTAL_FIELD_HIDDEN'.
    >    es_subtottxt-display_text_for_subtotal = 'Final Total'. endif.
    >
    >  ep_subtot_line-percentage = ep_subtot_line-numerator
    >             / ep_subtot_line-denominator
    >             * 100.
    >
    >  ep_subtot_line-perc = ep_subtot_line-percentage. endform.
    >
    THANKS
    MRUTYUN

  • ALV total and subtotaling problem

    Hi,
    I am unable to proceed in total and subtotal using ALV List Display.
    Fico Scenario
    For each change of Asset Location within same Asset Class:        
    Column Logic
    Location Total   Location wise do the Sum of the columns u201CAcquired Valueu201D, u201CSalv/168 Allow Sec 179u201D, Depreciable Basisu201D, u201CPrior Accum Depreciationu201D, u201CDepreciation This Runu201D, Current YTD Depreciationu201D, Current Accum Depreciationu201D and u201CNet Book Valueu201D
    Code Done :
    FORM summation .
      DEFINE m_fieldcat.
        add 1 to gs_fieldcat-col_pos.
        gs_fieldcat-fieldname   = &1.
        gs_fieldcat-ref_tabname = 'gt_fieldcat1'.
        gs_fieldcat-do_sum      = &2.
        gs_fieldcat-cfieldname  = &3.
        append gs_fieldcat to gt_fieldcat1.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to wa_sort-spos.
        wa_sort-fieldname = &1.
        wa_sort-up        = 'X'.
        wa_sort-subtot    = &2.
        append wa_sort to i_sort.
      END-OF-DEFINITION.
      m_fieldcat 'ANBTR' 'X'  ''.
      m_fieldcat 'SALV' 'X'  ''.
      m_fieldcat 'DEP_BASIC' 'X'  ''.
      m_fieldcat 'DEP_LAST' 'X' ''.
      m_fieldcat 'DEP_CURRUN' 'X'  ''.
      m_fieldcat 'DEP_CURYTD' 'X'  ''.
      m_fieldcat 'DEP_ACC' 'X' ''.
      m_fieldcat 'NET_BOOK' 'X'  ''.
      m_sort 'ANLKL' 'X'.
    m_sort 'SALV' 'X'.
    m_sort 'DEP_BASIC' 'X'.
    m_sort 'DEP_LAST' 'X'.
    m_sort 'DEP_CURRUN' 'X'.
    m_sort 'DEP_CURYTD' 'X'.
    m_sort 'DEP_ACC' 'X'.
    m_sort 'NET_BOOK' 'X'.
    gs_layout-cell_merge = 'X'.
    ENDFORM.                    " SUMMATION
    FORM alv_display .
      PERFORM build_catlog.
      PERFORM eventtab_field USING gs_event.
      PERFORM comment_build USING gt_list_top_of_page[].
    perform html_top_of_page using top. "TYPE REF TO cl_dd_document.
      gv_repid          = sy-repid.
      gs_variant-report = gv_repid.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-info_fieldname =   'LINE_COLOR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = gv_repid
         i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          is_layout                   = gs_layout
          is_variant                  = gs_variant
          it_events                   = gs_event[]
          it_fieldcat                 = gt_fieldcat1[]
          i_save                      = 'A'
        TABLES
          t_outtab                    = gt_output[]
        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.
    ENDFORM.                    " ALV_DISPLAY
    Any Help or Suggestions needed.
    Better if guided with the code as m new to ALV Reports.

    Hi,
    I am unable to proceed in total and subtotal using ALV List Display.
    Fico Scenario
    For each change of Asset Location within same Asset Class:        
    Column Logic
    Location Total   Location wise do the Sum of the columns u201CAcquired Valueu201D, u201CSalv/168 Allow Sec 179u201D, Depreciable Basisu201D, u201CPrior Accum Depreciationu201D, u201CDepreciation This Runu201D, Current YTD Depreciationu201D, Current Accum Depreciationu201D and u201CNet Book Valueu201D
    Code Done :
    FORM summation .
      DEFINE m_fieldcat.
        add 1 to gs_fieldcat-col_pos.
        gs_fieldcat-fieldname   = &1.
        gs_fieldcat-ref_tabname = 'gt_fieldcat1'.
        gs_fieldcat-do_sum      = &2.
        gs_fieldcat-cfieldname  = &3.
        append gs_fieldcat to gt_fieldcat1.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to wa_sort-spos.
        wa_sort-fieldname = &1.
        wa_sort-up        = 'X'.
        wa_sort-subtot    = &2.
        append wa_sort to i_sort.
      END-OF-DEFINITION.
      m_fieldcat 'ANBTR' 'X'  ''.
      m_fieldcat 'SALV' 'X'  ''.
      m_fieldcat 'DEP_BASIC' 'X'  ''.
      m_fieldcat 'DEP_LAST' 'X' ''.
      m_fieldcat 'DEP_CURRUN' 'X'  ''.
      m_fieldcat 'DEP_CURYTD' 'X'  ''.
      m_fieldcat 'DEP_ACC' 'X' ''.
      m_fieldcat 'NET_BOOK' 'X'  ''.
      m_sort 'ANLKL' 'X'.
    m_sort 'SALV' 'X'.
    m_sort 'DEP_BASIC' 'X'.
    m_sort 'DEP_LAST' 'X'.
    m_sort 'DEP_CURRUN' 'X'.
    m_sort 'DEP_CURYTD' 'X'.
    m_sort 'DEP_ACC' 'X'.
    m_sort 'NET_BOOK' 'X'.
    gs_layout-cell_merge = 'X'.
    ENDFORM.                    " SUMMATION
    FORM alv_display .
      PERFORM build_catlog.
      PERFORM eventtab_field USING gs_event.
      PERFORM comment_build USING gt_list_top_of_page[].
    perform html_top_of_page using top. "TYPE REF TO cl_dd_document.
      gv_repid          = sy-repid.
      gs_variant-report = gv_repid.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-info_fieldname =   'LINE_COLOR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = gv_repid
         i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          is_layout                   = gs_layout
          is_variant                  = gs_variant
          it_events                   = gs_event[]
          it_fieldcat                 = gt_fieldcat1[]
          i_save                      = 'A'
        TABLES
          t_outtab                    = gt_output[]
        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.
    ENDFORM.                    " ALV_DISPLAY
    Any Help or Suggestions needed.
    Better if guided with the code as m new to ALV Reports.

  • ALV Total and Subtotal in ALV

    Hi,
          I want to display the Total and Subtotal in Alv in Webdynpro Abap, and i am getting this  Error( Access via 'NULL' object reference not possible) and also i have checked the Cardinality also. Please get me a Good Solution.

    I think your node( the node which is binded to data node of alv interface controller ) having collection cardinality of 1:1, if yes, then change it to 0:N,
    i hope this will solve the issue.
    If you still get the error, go to st22, open your error, go down that page (keep pressing pagedown button ), then you will find your code and there find this arrow >>>>> then let me know that code line.
    Regards
    Srinivas

  • Calculate total and average for same key figure

    Hi Experts,
    I have a requirement where I need to calculate total and average for same key figure no of employees.
    eg:                
    If I enter 03,2009 as Input the reuslt should give from financiual year starting to current month.
         11.2008      12.2008     1.2009     2.2009     3.2009        average
             11          10       12       10        10         10.6
             10         10       11       12        10         10.6
    total         21         20       23       22        20          21.2
    we have only one characteristic in rows... companycode.
    Waiting for your Inputs.
    Regards
    Prasad Nannuri

    no it will work for u
    you have to use variable on 0calmonth or fiscal period depending on what Time characteristic u are using.
    lets say that variable is zcalmonth
    it is based on 0calmonth for e.g.
    now u restrict keyfigure with this variable zcalmonth with time char. = 0CALMONTH
    copy and paste the restricted keyfigure
    now set offset for variable in  variable selection screen dialog box = -1
    repeat this until u want
    make this variable mandatory
    now at query execution user will select any value for month/year
    and u will see all 5 months in result set
    now there can be maximum 12 months in a year, so u end up creating only 12 restricted keyfigures.
    use YEAR in restricted keyfigure too, and restrict it with YEAR VARIABLE processing by CUSTOMER EXIT = CURRENT YEAR
    in this case it will automatically removes any additional values...
    for e.e.g
    YEAR = 2008 only
    User entered 6/2008
    so lets say ur financial year starts in  april 2007 and ends in april 2008
    so u expect to see
    4/08
    5/08
    6/08
    but u created 12 restricted keyfigures , so it will show upto
    4,5,6 months only

  • How to display both total and subtotal with condition on

    Hi Experts,
    We had a special requirements from our "Powerful" user for a top sales ranking report:
    say user runs for top 10 customers, query/view (It has to be built as query/views because they are going be exported to Portal) need to show
    1. sub total 10 customers
    2. total for all customers
    3. for each customer to show their sales percentage out of the overall total sales
    any recommendation welcomes
    Regards,
    Feng

    Create a condition on the Sales Key Figure as Top N and value as 10.
    So when you run the report for the Customer in Rows and Sales Key Figure in Coulmns you will get the report output for 10 customers and their respective Sales Figure. But if you see the overall result, it will be for all customers and not for only 10 customers. To get the total of only 10 customers, right click on Sales Key Figure and select Calculate result as Summation.
    Now below Sales Key Figure, create a Formula Key Figure (FKF) that will give the Total Sales for All customers. Use the formula as below
    FKF = SUMGT (SALES)
    Now create another Formula Key Figure (FKF1) that will give the % Sales with respect to total Sales. use teh Formula as below
    FKF1 = Sales %A FKF

  • ADDING TOTAL AND SUBTOTAL FROM TWO DATASETS

    Hi there!
    I working in this report with two dataset, I need to add a subtotal and total, the balance is coming from Dataset2, and I bring this Balance with a Lookup .... everything is working fine, but I can't bring the subtotals 
    Thank you

    Hi Ysabel1111,
    Based on my understanding, you are retrieving data from another dataset with Lookup() function within a tablix. Then you want to perform a subtotal and total, right?
    In your scenario, since you are using Lookup() function to retrieve the second dataset’s data, you should embed the Lookup() function within Sum() function to perform subtotal or total. Please refer to our test steps and results:
    1. We use Lookup() function to retrieve Balance field from DataSet2.
    2. Specify the subtotal and total expression like below, then preview the report.
    Besides, you can only create one dataset, then specify the query to join the two tables. So that you can specify data for a tablix without Lookup() function.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Implementing Total and Subtotal in ADF tables

    Hi i use Jdeveloper 11.1.2.3.0...
    Please i just came across the ADF table subtotal and total function in oracle Docs but it didnt specify steps on how to accomplish that..... Im not a pro, so please if anyone has a link or link to a tutorial or can tell me the necessary steps to take so as to accomplish the subtotal and total in my ADF table, i will be very grateful.
    I await your reply.
    Thank you
    OBYYS

    Ok.. let me explain fully so you capture what in doing here....
    What i have is an SQL Query view (with a rollup) which has an input text, i highlight the input and in the properties Inspector --> Style --> contentStyle... i add the code "#{row.Course==null and row.Semester==null and row.Levell==null ? 'font-weight:bold;':''    But it shows thesame error, i also tried "inlineStyle" and it throws thesame error....
    (If you have skype you can add me [email protected] or mail me yours, i will be grateful)
    I appreciate your time, thank you...

  • Sub-total and Total for a column having checkboxes in WD ABAP ALV

    Hello Experts,
    I have used ALV in We bdynpro ABAP to display my output. There are 2 columns that are checkboxes in Output. I want a sub-total and total for those two columns. I know tht total and sub-total functionality is available only for numeric fields .
    Is there any other indirect way by which i can achieve the same ?

    Hi Ragini,
    Please refer this thread: [alv total and subtotal|How to display graphs;.
    I hope it helps.
    Regards
    Arjun

  • How to show the break totals and NOT the report totals in an SQL report

    APEX 4.0.1
    In an normal SQL report (Not interactive) with a break applied on the first column, how do you just show the break totals and NOT the extra full report totals?
    Next, Is it possible to display only some of the row totals and not for all columns that have the sum option checked against them?
    PaulP

    PaulP wrote:
    APEX 4.0.1
    In an normal SQL report (Not interactive) with a break applied on the first column, how do you just show the break totals and NOT the extra full report totals?Instead of using the APEX break feature, try doing all of this in the query using <tt>GROUPING SETS</tt> or <tt>ROLLUP</tt> to get the break rows, and <tt>GROUPING_ID</tt> in the <tt>HAVING</tt> clause to suppress the unwanted rows.
    Next, Is it possible to display only some of the row totals and not for all columns that have the sum option checked against them?Don't really understand what's meant here?

  • Totals and subtotals in blocked alv

    hi
    totals and subtotals for data type (CURR) fields is not coming in blocked alv report... Plz can u help us in this regard.. urgent.
    thnx in advance

    have a look on this
    REPORT  YMS_ALVBLOCKLIST.
    TABLES:LFA1,EKKO.
    SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    REGIO LIKE LFA1-REGIO,
    END OF ITAB.
    DATA:BEGIN OF JTAB OCCURS 0,
    LIFNR LIKE EKKO-LIFNR,
    EBELN LIKE EKKO-EBELN,
    BUKRS LIKE EKKO-BUKRS,
    BSTYP LIKE EKKO-BSTYP,
    EKORG LIKE EKKO-EKORG,
    BSART LIKE EKKO-BSART,
    END OF JTAB.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
    IN LIFNR.
    SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE JTAB WHERE LIFNR
    IN LIFNR.
    TYPE-POOLS:SLIS.
    DATA:LAYOUT TYPE slis_layout_alv.
    DATA:EVE TYPE slis_t_event WITH HEADER LINE.
    DATA:EVE1 TYPE slis_t_event WITH HEADER LINE.
    DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
    DATA:FCAT TYPE slis_t_fieldcat_alv.
    DATA:FCAT1 TYPE slis_t_fieldcat_alv.
    LAYOUT-ZEBRA = 'X'.
    LAYOUT-colwidth_optimize = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'VENDOR DETAILS SCREEN'.
    EVE1-NAME = 'TOP_OF_PAGE'.
    EVE1-FORM = 'TOP_OF_PAGE1'.
    APPEND EVE1.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = EVE[]
    EXCEPTIONS
    LIST_TYPE_WRONG = 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.
    READ TABLE EVE WITH KEY NAME = 'TOP_OF_PAGE'.
    EVE-FORM = 'TOP_OF_PAGE'.
    MODIFY EVE TRANSPORTING FORM WHERE NAME = 'TOP_OF_PAGE'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    * IT_EXCLUDING =
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    * I_STRUCTURE_NAME =
    * I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME = SY-REPID
    * I_BYPASSING_BUFFER =
    * I_BUFFER_ACTIVE =
    CHANGING
    CT_FIELDCAT = FCAT
    * EXCEPTIONS
    * INCONSISTENT_INTERFACE = 1
    * PROGRAM_ERROR = 2
    * OTHERS = 3
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    I_TABNAME = 'ITAB'
    IT_EVENTS = EVE[]
    * IT_SORT =
    * I_TEXT = ' '
    TABLES
    T_OUTTAB = ITAB
    * EXCEPTIONS
    * PROGRAM_ERROR = 1
    * MAXIMUM_OF_APPENDS_REACHED = 2
    * OTHERS = 3
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'JTAB'
    * I_STRUCTURE_NAME =
    * I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME = SY-REPID
    * I_BYPASSING_BUFFER =
    * I_BUFFER_ACTIVE =
    CHANGING
    CT_FIELDCAT = FCAT1
    * EXCEPTIONS
    * INCONSISTENT_INTERFACE = 1
    * PROGRAM_ERROR = 2
    * OTHERS = 3
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT1
    I_TABNAME = 'JTAB'
    IT_EVENTS = EVE1[]
    * IT_SORT =
    * I_TEXT = ' '
    TABLES
    T_OUTTAB = JTAB
    * EXCEPTIONS
    * PROGRAM_ERROR = 1
    * MAXIMUM_OF_APPENDS_REACHED = 2
    * OTHERS = 3
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    * EXPORTING
    * I_INTERFACE_CHECK = ' '
    * IS_PRINT =
    * I_SCREEN_START_COLUMN = 0
    * I_SCREEN_START_LINE = 0
    * I_SCREEN_END_COLUMN = 0
    * I_SCREEN_END_LINE = 0
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
    * 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.
    FORM TOP_OF_PAGE.
    REFRESH HEAD.
    HEAD-TYP = 'H'.
    HEAD-INFO = 'VENDORS DETAILS'.
    APPEND HEAD.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = HEAD[]
    * I_LOGO =
    * I_END_OF_LIST_GRID =
    ENDFORM.
    FORM TOP_OF_PAGE1.
    REFRESH HEAD.
    HEAD-TYP = 'H'.
    HEAD-INFO = 'PURCHASE DOCCUMENTS DETAILS'.
    APPEND HEAD.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = HEAD[]
    * I_LOGO =
    * I_END_OF_LIST_GRID =
    ENDFORM.

  • TOTAL AND EXTRACTS IN TMG

    hi experts,
                while going through the postings in forums regarding
      events in table maint. generator I came across the terms
      extracts and total . Can anybody please explian to me what is this extract and total?
    regards
    pankaj

    Hi Pankaj.
    I would like to suggest a couple of references,
    [SAP HELP Library - Standard Reference for Converting the Data Containers TOTAL and EXTRACT|http://help.sap.com/saphelp_nw04/helpdata/en/33/96613cb44b6c4de10000000a11405a/content.htm]
    [SAP HELP Library - Standard Reference for Extended Table Maintenance Events - Before Saving the Data in the Database - TOTAL and EXTRACT|http://help.sap.com/saphelp_nw04/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/frameset.htm]
    [SDN - Reference - Events in Table Maintenance - Issue - TOTAL and EXTRACT|Problem: Events in Table Maintenance;
    [SDN - Reference - Events in table maintenance generator - Table Total and Extract for getting the table records|events in table maintenance generator;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

Maybe you are looking for

  • Wifi Greyed on 4S & no Panorama option on camera

    I purchased a 4s for the Mrs in February 13 and ever since she has had it the wifi option is greyed and no option of the Panorama in camera options although the 'grid' and 'hdr' options are there. I have restored the phone from new, reset all setting

  • Submenu HOVER change doesn't work

    I've tried everything I could think of (for the past 2 hours). The Submenu Text Change Instruction doesn't work for me (PC, IE7 and Firefox) I've tried to add all kinds of properties to make the SUBMENU Item change when the mouse hovers over it. What

  • Pentax DSmobile 600 with Image Capture only sayd "No paper loaded..."

    I was using Paperless to scan documents, but Paperless is not fully working on Snow Leopard yet. I re-installed the Pentax DSmobile 600 TWAIN driver tonight, but I still cannot scan documents into my Mac. If I select "Flatbed" as the Scan Mode, I can

  • Outlook:Mac 2011 Slow When Switching to Contacts

    I am having problems with Outlook Mac.  I am on a 1.7 GHz i5 4GB Macbook Air.  When I switch from mail or calendar to contacts, the spinning wheel goes for about 15 seconds before I can search a contact.  I can seach for a contact just fine using spo

  • Pricing Procedure in Opportunity

    Hai Experts, Where can we see the Pricing procedure in Opportunity Transaction, for example we can see the pricing procedure in Prices Tab for Quotation, similarly where can we see that for Opportunity? Thanks and Regards, Teja