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

Similar Messages

  • 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

  • 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.

  • 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 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

  • 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

  • How to write code  for totals and subtotals in alv programing?

    how to write code  for totals and subtotals in alv programing?

    hi,
    1. <u><b>TOTAL.</b></u>
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
    2. <u><b>How do I add subtotals</b></u>
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Regards
    Anver

  • 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

  • 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...

  • 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

  • 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

  • IN ALV HOW WE CAN TOTALS AND SUBTOTALS?

    HI EXPERTS?
    IN ALV HOW WE CAN TOTALS AND SUBTOTALS?

    Hi
    FOR DISPLAYING TOTALA AND SUBTOTALS IN ALV USE THIS:
    data: wa_fieldcat type slis_fieldcat_alv,
          it_fieldcat type slis_t_fieldcat_alv.
    data: wa_sort type slis_sortinfo_alv,
          it_sort type slis_t_sortinfo_alv.
    wa_fieldcat-do_sum = 'X'.
    append wa_fieldcat to it_fieldcat.
    wa_sort-fieldname = 'KUNNR'.
    wa_sort-tabname = 'IT_FINAL'.
    wa_sort-subtot = 'X'.
    append wa_sort to it_sort.
    AN EXAMPLE RELATED TO IT:
    This ALV program have all the basic report requirements such as page heading, page no, sub-total and a grand total.
    This is a basic ALV with the followings:-
    - Page Heading
    - Page No
    - Sub-Total
    - Grand Total
    REPORT ZALV.
    TYPE-POOLS: SLIS.
    DATA: G_REPID LIKE SY-REPID,
    GS_PRINT            TYPE SLIS_PRINT_ALV,
    GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
    GT_EVENTS           TYPE SLIS_T_EVENT,
    GT_SORT             TYPE SLIS_T_SORTINFO_ALV,
    GS_LAYOUT           TYPE SLIS_LAYOUT_ALV,
    GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
    FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
    COL_POS TYPE I.
    DATA: BEGIN OF ITAB,
      FIELD1(5) TYPE C,
      FIELD2(5) TYPE C,
      FIELD3(5) TYPE P DECIMALS 2,
    END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB1.
    DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
      INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB_FIELDCAT.
    Print Parameters
    PARAMETERS:
                P_PRINT  AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
                P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
                P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
                P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
                P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
                P_RESERV TYPE I.                  "NO OF FOOTER LINE
    INITIALIZATION.
    G_REPID = SY-REPID.
    PERFORM PRINT_BUILD    USING GS_PRINT.      "Print PARAMETERS
    START-OF-SELECTION.
    TEST DATA
    MOVE 'TEST1' TO ITAB1-FIELD1.
    MOVE 'TEST1' TO ITAB1-FIELD2.
    MOVE '10.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    MOVE 'TEST2' TO ITAB1-FIELD1.
    MOVE 'TEST2' TO ITAB1-FIELD2.
    MOVE '20.00' TO ITAB1-FIELD3.
    APPEND ITAB1.
    DO 50 TIMES.
      APPEND ITAB1.
    ENDDO.
    END-OF-SELECTION.
    PERFORM BUILD.
    PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
    PERFORM COMMENT_BUILD  CHANGING GT_LIST_TOP_OF_PAGE.
    PERFORM CALL_ALV.
    FORM BUILD.
    DATA FIELD CATALOG
    Explain Field Description to ALV
    DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD1'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
    FIELDCAT_LN-KEY       = ' '.   "SUBTOTAL KEY
    FIELDCAT_LN-NO_OUT    = ' '.
    FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME = 'FIELD2'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    FIELDCAT_LN-NO_OUT    = 'X'.
    FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_IN.
    FIELDCAT_LN-FIELDNAME     = 'FIELD3'.
    FIELDCAT_LN-TABNAME       = 'ITAB1'.
    FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
    FIELDCAT_LN-REF_TABNAME   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
    FIELDCAT_LN-NO_OUT        = ' '.
    FIELDCAT_LN-DO_SUM        = 'X'.   "SUM UPON DISPLAY
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    DATA SORTING AND SUBTOTAL
    DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD1'.
    GS_SORT-SPOS      = 1.
    GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD2'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    ENDFORM.
    FORM CALL_ALV.
    ABAP List Viewer
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
    IS_LAYOUT =  GS_LAYOUT
    IT_FIELDCAT = GT_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
      IT_SORT = GT_SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
      IT_EVENTS = GT_EVENTS[]
    IT_EVENT_EXIT =
      IS_PRINT = GS_PRINT
    IS_REPREP_ID =
    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 =
    TABLES
    T_OUTTAB = ITAB1
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    ENDFORM.
    HEADER FORM
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    *GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    define END_OF_PAGE event
    READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_END_OF_PAGE
                             INTO LS_EVENT.
    IF SY-SUBRC = 0.
      MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
      APPEND LS_EVENT TO LT_EVENTS.
    ENDIF.
    ENDFORM.
    FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: GS_LINE TYPE SLIS_LISTHEADER.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'H'.
      GS_LINE-INFO = 'HEADER 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      CLEAR GS_LINE.
      GS_LINE-TYP  = 'S'.
      GS_LINE-KEY  = 'STATUS 1'.
      GS_LINE-INFO = 'INFO 1'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
      GS_LINE-KEY  = 'STATUS 2'.
      GS_LINE-INFO = 'INFO 2'.
      APPEND GS_LINE TO GT_TOP_OF_PAGE.
    CLEAR GS_LINE.
    GS_LINE-TYP  = 'A'.
    GS_LINE-INFO = 'ACTION'.
    APPEND GS_LINE TO  GT_TOP_OF_PAGE.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
      WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
    ENDFORM.
    FORM END_OF_PAGE.
      WRITE at (sy-linsz) sy-pagno CENTERED.
    ENDFORM.
    PRINT SETTINGS
    FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
      LS_PRINT-PRINT              = P_PRINT.  "PRINT IMMEDIATE
      LS_PRINT-NO_PRINT_SELINFOS  = P_NOSINF. "NO SELECTION INFO
      LS_PRINT-NO_COVERPAGE       = P_NOCOVE. "NO COVER PAGE
      LS_PRINT-NO_NEW_PAGE        = P_NONEWP.
      LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
      LS_PRINT-RESERVE_LINES      = P_RESERV.
    ENDFORM.
    thnx
    Sravani
    Plz reward if useful

  • 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

  • Subtotal in alv after sort

    i have six fields,
       based upon the sorting of all 5 fields, i should get the subtotal for sixth field in the alv list report(i have used func module alv_list_display').
    How can I set the sorting sequence in IT_SORT?
    and display the sub-total.

    Hai
    Go through the following Example Code
    Refer to this similar thread.
    alv Display :Total and subtotal
    for sub totals you have to use
    sort table.
    sort-fieldname = 'VBELN'.
    sort-tabname = 'ITAB'.
    sort-up = 'X'.
    sort-subtot = 'X'.
    append sort to it_sort.
    Or
    Define SORT table and FIELDCATALOG table .
    Data :i_field type slis_t_fieldcat_alv,
    w_field like line of i_field,
    i_sort type slis_t_sortinfo_alv,
    w_sort like line of i_sort.
    2.Grand Total
    While buildingfieldcatalog,We have to set DO_SUM = 'X' for quantity field .
    ex.
    w_field-fieldname = 'MENGE'.
    w_field-tabname = 'I_TAB'.
    w_field-DO_SUM = 'X'.
    append w_field to i_field.
    clear w_field.
    3.Subtotal
    Whenever WERKS is changed Subtotal is displayed .
    Build sort table .
    Clear: w_sort,i_sort[].
    w_sort-spos = 1.
    w_sort-fieldname = 'WERKS'.
    w_sort-up = 'X'.
    w_sort-subtot = 'X'.
    append w_sort to i_sort.
    clear w_sort.
    4.
    Pass this I_SORT table thru REUSE_ALV_LIST_DISPLAY function module ..like fieldcatalog table.
    Or
    For sub totals you need to sort and pass the sort table to FM.
    But for total you need to pass to field catalog like below
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.       "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
    Thanks & regards
    Sreeni

  • Subtotal in ALV grid for a particular type and Grand total in ALV

    Hi,
    I need to have sub total for a particular type(eg: goods, services).. and grand total at end in ALV grid..
    ALV output required as below:
    Type     VAT registration number     Country      Total Gross Amounts       Total Tax Amounts       Total Amount, ex-tax
    Goods     ATU12345678     AT                  222.42      0         222.42
    Goods     NL123456789B02     NL               3,417.00      0      3,417.00
         Goods Total                    3,639.42                -         3,639.42
    Services     ATU12345678     AT               2,342.34      0      2,342.34
    Services     NL123456789B02     NL                  223.33      0         223.33
         Services Total                    2,565.67                -         2,565.67
         Grand Total                    6,205.09                -         6,205.09
    Let me as to how to achieve the above type in ALV grid...
    Regards
    Shiva

    check this link..
    Grand Totals in ALV grid disply function module
    or do like this..
    REPORT  ZALVTESTFORSUBTOTAL.
    tables:pa0008.
    type-pools:slis.
    types:begin of ty_pa0008,
          pernr like pa0008-pernr,
          begda like pa0008-begda,
          endda like pa0008-endda,
          ansal like pa0008-ansal,
          lga01 like pa0008-lga01,
          bet01 like pa0008-bet01,
          end of ty_pa0008.
    data:it_pa0008 type standard table of ty_pa0008 with header line.
    data:it_fieldcat type SLIS_T_FIELDCAT_ALV,
         wa_fieldcat type slis_fieldcat_alv,
         it_layout type slis_layout_alv,
         WA_events TYPE slis_alv_event,
         it_events TYPE slis_t_event.
    select-options:s_pernr for pa0008-pernr.
    start-of-selection.
    perform getD_data.
    perform disp_alv.
    *&      Form  getD_data
          text
    -->  p1        text
    <--  p2        text
    form getD_data .
    select pernr
           begda
           endda
           ansal
           lga01
           bet01
           from pa0008
           into table it_pa0008
           where pernr in s_pernr.
    sort it_pa0008 by pernr begda descending.
    endform.                    " getD_data
    *&      Form  disp_alv
          text
    -->  p1        text
    <--  p2        text
    form disp_alv .
    wa_fieldcat-fieldname = 'PERNR'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Personnel no'.
    *WA_FIELDCAT-no_subtotals = 'X'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'BEGDA'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Start date'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'ENDDA'.
    wa_FIELDCAT-REPTEXT_DDIC = 'End date'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'ANSAL'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Annula salary'.
    wa_fieldcat-do_sum = 'X'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'LGA01'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Wage Type'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'BET01'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Amount for wagetype'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    DATA: sort TYPE slis_sortinfo_alv,
    it_sort TYPE slis_t_sortinfo_alv.
    sort-fieldname = 'PERNR'.
    sort-subtot = 'X'.
    SORT-UP = 'X'.
    APPEND sort TO it_sort.
    *sort-fieldname = 'BEGDA'.
    *SORT-NO_SUBTOTS = 'X'.
    *APPEND sort TO it_sort.
    IT_layout-totals_text = 'total text'.
    IT_layout-subtotals_text = 'Subtotal text'.
    *WA_EVENTS-NAME = 'SUBTOTAL TEXT'.
    *WA_EVENTS-FORM = 'SUBTOTAL TEXT'.
    *APPEND WA_EVENTS TO IT_EVENTS.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = sy-repid
       IS_LAYOUT                      = it_LAYOUT
       IT_FIELDCAT                    = IT_FIELDCAT
       it_sort                        = it_sort
      it_events                      = it_events
       TABLES
        t_outtab                       = it_pa0008 .
    endform.                    " disp_alv

Maybe you are looking for

  • Shared calendar with OC 2005Q4

    Hi, I try to use shared calendars with OC 2005Q4. I have Calendar Server 05Q4 and CE 05Q4. When I try to set permission for my calendar to another user, i get an error message: User not found. Either enter the email id of the user OR click on Search

  • Picture files only partially display after being published

    Recently .jpg and .png pictures I have created only partially display after being published.  I've tested it using Paint, Publisher and Gimp with mixed results. The pictures display correctly when I view them locally on my pc. Here are the test pictu

  • Material-resource-cost center list

    Dear Friends where can i get the list of the Materils related to resourcese +  costcenter . which materils are using the costcenter with resource name i  want to know. Please let me know. Regards, srihari.M

  • Image Field Read Only

    Is there any way I can make an image field on a form "read only" after an image has been inserted? Probably to be changed via some password security setting etc? Thanks

  • Connect PostgreSql in ABAP Program

    Hi All, I have a requirement, there is an external software with postgresql DB. I want to fetch some data from this postgre DB to in ABAP program. How can i connect this DB in my ABAP program. Please help . Regards Jitendra Singh