Reg: Subtotal and final total in smartform?

Hi Experts,
I'm working on a smartform where i need to display the line items from lips table.
This is my final internal table.
TYPES : BEGIN OF it_final,
          matnr    TYPE lips-matnr,       "Article
          vbeln    TYPE likp-vbeln,       "Delivery Number
          arktx    TYPE lips-arktx,       "Article Description
          vrkme    TYPE lips-vrkme,       "Unit of Measure
          lfimg    TYPE lips-lfimg,       "Delivery Quantity
          kunag    TYPE kunag,            " Sold To
          name     TYPE name1,            " Name
          charg    TYPE lips-charg,       "Batch Number
          vfdat    TYPE lips-vfdat,       "Expiry Date
          lgort    TYPE lips-lgort,       "Storage Location
          matkl    TYPE lips-matkl,       "Merchandise Category
          wgbez    TYPE t023t-wgbez,      "Merchandise Category Desc
          lgpbe    TYPE lips-lgpbe,       "BIN Number
          pikmg(20) TYPE c,               "Picking Quantity
          route    TYPE likp-route,       "Route
       END OF it_final,
For one material number, there will be many line items, I need to have a subtotal for a particular material and at the end i need afinal total for all the material number.
I have sorted my internal table as sort it_final ascending by matnr vbeln.
Then this internal table is moved to smartform.
In smartform i'm using table to display the complete data. Here i need to segregate into subtotal and total.
Please help me to display the data in below format.
For Ex:
MATNR                    DESC                          QTY                  VBELN
1000001                  tea                               12                     3500000012
1000001                  tea                               02                     3500000013
                                          subtotal             14
1000006                  salt                              01                      3500000013
                                          subtotal             01
1000008                  sugar                          02                       3500000015
1000008                  sugar                          02                       3500000012
1000008                  sugar                          02                       3500000013
1000008                  sugar                          02                       3500000016
                                          subtotal             08
Total                                                            23
Thanks in advance.
Guys, The data is not getting displayed in Preview properly. Please edit and read it or copy in the notepad and read it.
Regards,
Abdur Rafique
Edited by: abdur rafique on Aug 8, 2009 3:38 PM

HI,
for the total it is easy.
Just calculate the total in a variable just before the table in the smartforms.
Display the total variable in the FOOTER section of the table.
To display the subtotal you will have to do i bit of workaround.
In the table create 2 LINE TYPES.
The 1st line type will have the four columns to display MATNR DESC QTY VBELN.
The 2nd line type will be of single column which will be used to display the subtotal.
In the main section of the table create 2 rows of the above line types.
In the 1st row display the MATNR DESC QTY VBELN as normal.
In the 2nd row display the subtotal.
This should be done as follows:-
Add one more column in your internal table as follows:-
MATNR DESC QTY VBELN SUBTOTAL.
Now you have to do some coding to create your internal table as follows:-
MATNR DESC  QTY VBELN SUBTOTAL.
1           test     10    100001
1           test     10    100002
1           test     20    100003 40
2           test2   10    100006 10
3           test3   50    100009 
3           test3   60    100010 110
This internal table should be created before displaying the table in the smartforms.
Then this internal table should be used in the smartforms.
The subtotal column should be shown in the 2nd row of the main area of the TABLES.
Also add a condition to it that it should be shown only when the column SUBTOTAL of the table contains any value.
So in this way you will be able to achieve your required output.
i hope you understand my idea.
regards,
Ankur Parab

Similar Messages

  • ALV GRID: How to change Subtotal and Main total values in standard row

    Hi Experts,
    By using SORT-SUBTOT = 'X' and  FIELDCATALOG-DO_SUM    = 'X', I will get subtotal and Main total.
    My requiremnt is I need be calculate values manually and pass the calculated values to subtotal and maintotal.
    is it possible in ALV GRID?
    By adding extra row we will do this but I am looking standard subtotal and maintotal row change.
    Thanks in advance,
    Mahe

    Hi,
    With function REUSE_ALV_GRID_DISPLAY you cannot do this.
    It´s possible if you create a class inherited from cl_gui_alv_grid and rewrite the method set_data_table, you can do this. Like:
    CLASS xgrid DEFINITION INHERITING FROM cl_gui_alv_grid.
      PROTECTED SECTION.
        METHODS: set_data_table REDEFINITION.
    ENDCLASS.                    "xgrid DEFINITION
    CLASS xgrid IMPLEMENTATION.
      METHOD set_data_table.
    * ....MODIFY data_table ...
        CALL METHOD super->set_data_table
          CHANGING
            data_table = data_table.
      ENDMETHOD.                    "set_data_table
    ENDCLASS.                    "xgrid IMPLEMENTATION
    DATA:    grid  TYPE REF TO xgrid.
      CREATE OBJECT custom_container EXPORTING container_name = mycontainer.
      CREATE OBJECT grid  EXPORTING i_parent = custom_container.
      CALL METHOD grid1->set_table_for_first_display ...
    Best regards,
    Leandro Mengue

  • How to do subtotal and grand total as per currency in a tree ALV

    Hi Experts,
    I am doing a tree ALV for SD output. I met an urgent problem that is how to do subtotal and grand total on the field (netwr) as per currency (waerk) in the tree ALV. I am using below codes to create the tree ALV.
        l_tree_container_name = 'CCONTAINER1'.
        CREATE OBJECT objCustomContainer
            EXPORTING
                  container_name = l_tree_container_name
            EXCEPTIONS
                  cntl_error                  = 1
                  cntl_system_error      = 2
                  create_error               = 3
                  lifetime_error              = 4
                  lifetime_dynpro_dynpro_link = 5.
    create tree control
        CREATE OBJECT objTree1
          EXPORTING
              parent              = objCustomContainer
              node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
              item_selection      = ' '
              no_html_header      = 'X'
              no_toolbar          = ''
          EXCEPTIONS
              cntl_error                   = 1
              cntl_system_error       = 2
              create_error                = 3
              lifetime_error               = 4
              illegal_node_selection_mode  = 5
              failed                       = 6
              illegal_column_name          = 7.
        DATA l_hierarchy_header TYPE treev_hhdr.
        call method buildHierarchyHeader
          IMPORTING
            p_hierarchy_header = l_hierarchy_header.
    Build fieldcatalog
        call method buildFieldcatalog.
        CALL METHOD objTree1->set_table_for_first_display
            EXPORTING
              is_hierarchy_header = l_hierarchy_header
            CHANGING
              it_fieldcatalog     = l_fieldcatalog
              it_outtab            = lt_order.             
        CALL METHOD objTree1->update_calculations.
        CALL METHOD objTree1->frontend_update.
    filling fieldcatalog,
          LS_FIELDCATALOG-FIELDNAME = 'NETWR'.
          LS_FIELDCATALOG-SCRTEXT_S = 'Net Value'.
          LS_FIELDCATALOG-COL_POS = l_pos.
          LS_FIELDCATALOG-OUTPUTLEN = 15.
          LS_fieldcatalog-do_dum= 'X'.
          LS_FIELDCATALOG-DATATYPE = 'CURR'.
          APPEND LS_FIELDCATALOG TO l_FIELDCATALOG.
          CLEAR LS_FIELDCATALOG.
          l_pos = l_pos + 1.
    I could see the subtotal and grandtotal in tree ALV but they are simply sumed up  regardless different currency.
    Thank you very much for your kindly helps.
    Yu

    hi
    good
    go through this report and work accordingly.
    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.
    thanks
    mrutyun^

  • Can we get subtotal and grand total by own calculation in a hierarchy ALV?

    Can we get subtotal and grand total by own calculation in a hierarchy ALV? I can get them by setting DO_SUM = 'X' by standard summation, but now I need to do my own summation on subtotal and total, can I?

    Can we get subtotal and grand total by own calculation in a hierarchy ALV? I can get them by setting DO_SUM = 'X' by standard summation, but now I need to do my own summation on subtotal and total, can I?

  • Subtotal and grand total for two fields(iseg-buchm and iseg-erfmg)

    hi experts,
        how to do subtotal and grand total for two fields (iseg-buchm and iseg-erfmg).please help me on solving the problem.

    subtotal & grand total can be done in folowing way in ALV.
    1.Pass it_sort parametere to REUSE_ALV_GRID_DISPLAY
    2.Give the field name for sorting in it_sort-fieldname. it can be any field name  u want to sort ur data with.
    3.For iseg-buchm & iseg-erfmg mark do_sum = 'X'. in fieldcat
      gs_sort-spos = 1.
      gs_sort-fieldname = 'ANY FIELD NAME'.
      gs_sort-up = 'X'.
      gs_sort-subtot = 'X'.
      APPEND gs_sort TO et_sort.
      IF iv_fieldname = 'BUCHM'
      OR iv_fieldname = 'ERFMG'.
        gs_fieldcat-do_sum = 'X'.
      ENDIF.
      APPEND gs_fieldcat TO gt_fieldcat.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
           is_variant              = ev_variant
          it_fieldcat             = gt_fieldcat[]

  • Problem with subtotal, and the total icon is not displayed at the toolbar

    Hi all,
    I'm currentlyhaving difficulties working with the subtotal and the grandtotal. I have the code in the right place like the sort table
      CLEAR k_sort.
      ADD 1 TO k_sort-spos.
      k_sort-fieldname = pv_fieldname.
      k_sort-up        = c_x.
      k_sort-subtot    = pv_subtot.
      APPEND k_sort TO i_sort.
    and the fieldcatalog
      CLEAR k_fieldcat.
      add 1 to k_fieldcat-col_pos.
      k_fieldcat-fieldname  = pv_fieldname.
      k_fieldcat-tabname    = c_tabname.
      k_fieldcat-seltext_l  = pv_seltext.
      k_fieldcat-outputlen  = pv_outputlen.
      k_fieldcat-datatype   = pv_datatype.
      k_fieldcat-do_sum     = pv_dosum.
      APPEND k_fieldcat TO i_fieldcat.
    but it didn't seems to show both the total and subtotal. Even the icon is not displayed at the ALV toolbar. The field which I need the total is a currency field. I even try other fields (interger fields) but with no luck. I'm using REUSE_ALV. Any help is greatly appreciated.

    hi,
    In field catalog for the particular column which you want to sum make that as 'X'.
    say
    WHEN'MATNR'.
    it_fcat-do_sum = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program     = report_id
                i_grid_title           = ws_title
    *            i_callback_top_of_page = 'TOP-OF-PAGE'
                is_layout              = wa_layout
                it_fieldcat            = i_fieldcat[]
                it_sort                = i_sortcat
                i_save                 = 'A'
                it_events              = i_events
           TABLES
                t_outtab               = i_reportdata1
           EXCEPTIONS
                program_error          = 1
                OTHERS                 = 2.
      IF sy-subrc <> 0.
    This will enable.

  • How to display subtotal and grand total with a top 10 condistion ?

    Hello,
    I would like to display a Top 10 list with subtotal for Top 10 and grand total for all the lines.
    I succeed to display top 10 subtotal with "calculations/total" parameter but my question is How to display also the grand total for all the lines ?
    Thank you in advance.
    Best regards
    Nicolas

    Calculate Results/not defined gives grand total and calculation / total gives top 10 sum. As far as I know, you can't display both at the same time.

  • Line Totalling and page totalling in smartforms?

    Hi,
    Any ideas about displaying line totals and page/grand totals in smartform. Answers would be appreciated.
    thanks

    Hi..,
    in TABLE you will have one tab called CALCULATIONS..
    in that select the type as TOTAL and give the field name for which u want to find out the total. and give the resultant field into which u want the total to be stored !! and select AFTER LOOP in the next list box...
    in the footer you just write this field name. u will get the cumulative total for each .. i mean for second page the total of ( the first page and second page) will get printed !!
    if u want the total for each page then u need to write a program line for the table.. to clear the total field for each page !!
    reward if it helps u,
    sai ramesh

  • How to do SUBTOTAL AND TOTAL in Main Window of SAPSCRIPT.

    Hello Friends,
    I am modifying standard SAPSCRIPT of packing slip. My client wants a subtotal and total in Main Window of Script for Eg. (They want Material Number wise Subtotal and finally Grandtotal at bottom in Main Window)
    Now i got stucked up here how to do it ?
    here is my sample code.
    LOOP AT XVBPLP WHERE VENUM = SHENR.
    IF XVBPLP-POSNR IS INITIAL.
        Versandelement
          PERFORM PACKING_TREE USING XVBPLP-UNVEL.
        ELSE.
        Lieferposition (Anteil)
          VBPLP = XVBPLP.
      CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            ELEMENT = 'DELPOS'.                     "Main Window call
    clear vbplp.
    ENDLOOP.
    Pls guide me for the same.

    HI,
    For the Line items, put a ELEMENT in the Smartform, and you will call this with in the LOOP and ENDLOOP, so here with in the LOOP count the TOTAL value.
    then create new element after the Line item Element, and call this Element after the Line items prints,
    /E  LINE_ITEM
      &1& &2 & &3&     " This will be in the loop and you need to caliculate the totla here
    /E SUB_TOTAL.
    &SUb_TOTAL&  " After all the line items pritns then call this Element
    Regards
    Sudheer

  • 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

  • How to make function: line amount total and final colum total at the bottom (Acrobat pro 9)?

    The form is like this:
    col 1
    col 2
    col 3
    col 4
    col 5
    Row 1
    amount
    amount
    amount
    line total
    Row 2
    amount
    amount
    amount
    line total
    Row 3
    amount
    amount
    amount
    line total
    Row 4
    amount
    amount
    amount
    line total
    Row 5
    colum total
    colum total
    colum total
    colum total
    The problem is that even though the calculation seems to be right, the final total, colum totals and some of the line totals don't update. The sum remains zero.
    Could there be a wrong tab order? Could somebody tell me the right order? I've tried several variations, but I just can't get it work . Could somebody help me please?
    Thanks in advance!

    It's most likely an incorrect field calculation order, which is not at all related to the tab order. In case you don't know how to set it, select "Forms > Add or Edit Fields" to go into form editing mode, and then select "Forms > Edit > Set Field Calculation Order".
    Arrange the order so it makes sense, which looks like it should be:
    col 2 total
    col 3 total
    col 4 total
    Row 1 total
    Row 2 total
    Row 3 total
    Row 4 total
    Row 5 total
    Other arrangements might be just a correct, but it's important that the row totals are in that order. You should also check it again when you have the form ready to distribute to make sure it hasn't changed as you've done further editing.

  • My subtotal and total text in ALV list does not show...

    Hello Experts,
    Please see my code below on what I am doing wrong. I want to display the subtotal and total text in my ALV list.
    CLEAR gs_layout.
        gs_layout-colwidth_optimize = 'X'.
        gs_layout-zebra             = 'X'.
        gs_layout-subtotals_text    = 'Subtotal'.
        gs_layout-totals_text       = 'Total'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
    *       I_INTERFACE_CHECK                 = ' '
    *       I_BYPASSING_BUFFER                = ' '
    *       I_BUFFER_ACTIVE                   = ' '
            i_callback_program                = sy-repid
    *       I_CALLBACK_PF_STATUS_SET          = ' '
    *       I_CALLBACK_USER_COMMAND           = ' '
    *       I_CALLBACK_TOP_OF_PAGE            = ' '
    *       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *       I_CALLBACK_HTML_END_OF_LIST       = ' '
    *       I_STRUCTURE_NAME                  =
    *       I_BACKGROUND_ID                   = ' '
    *       I_GRID_TITLE                      =
    *       I_GRID_SETTINGS                   =
            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
    *       I_HTML_HEIGHT_TOP                 = 0
    *       I_HTML_HEIGHT_END                 = 0
    *       IT_ALV_GRAPHICS                   =
    *       IT_HYPERLINK                      =
    *       IT_ADD_FIELDCAT                   =
    *       IT_EXCEPT_QINFO                   =
    *       IR_SALV_FULLSCREEN_ADAPTER        =
    *     IMPORTING
    *       E_EXIT_CAUSED_BY_CALLER           =
    *       ES_EXIT_CAUSED_BY_USER            =
          TABLES
            t_outtab                          = lt_output_fin
         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.

    Use on Thread. Don't Cross post. and Follow the Rules.

  • How to show underline and overline for subtotal and total row in Cross tab

    Hi,
    I am developing cross tab report where i need to show undeline and overline in data for subtotal row and total row so as to distuingish normal rows from subtotal and total row.
    Thanks,
    Mahesh

    Hi BIPuser,
    i looked at the updated template, we need undeline on the data corresponding to subtotal row for ex. row 2.
    We have xml tag in xml data UNDERLINE_AFTER='Y' and UNDERLINE_BEFORE='Y' then we need to show underline and overline on data i.e on 121,122,123,221,222,223 ,not on ROW2.
    value1 value2
    row1 200 300
    row2 400 700
    we need underline and oveline on data 400 and 700 since it is subtotal data based on condition UNDERLINE_AFTER='Y' and UNDERLINE_BEFORE='Y'.
    Hope you understand.
    Please help!!!!!!
    Thanks,
    Mahesh
    Edited by: user13450806 on Feb 2, 2011 12:14 AM

  • Keep subtotal and hide grand total

    Hi,
    I have an ALV whose subtotal should be displayed and grand total hidden. CL_SALV_WD_FIELD=>IF_SALV_WD_SORT~SET_AGGREGATION_ALLOWED calculate both subtotal and subtotal. How can I only display subtotal?
    Thanks,
    ts

    Hi Kumar,
    In the Layout, there is a parameter called "NO_TOTALLINE". Set this to 'X" and see if the grand total is hidden in your ALV display.
    Also, in the SORT table that you build for sub-totals and totals, there are these two fields         
    comp(1) type c,
    expa(1) type c,
    Here EXPA is used to HIDE all the line items and displa only totals.
    So, just check with these two parameters.
    Best Regards,
    Ram.
    Edited by: ram Kumar on Dec 18, 2008 12:02 PM

  • How to show subtotal and total of groups in ssrs

    I am making an SSRS report in following format:
        DIVISION  
              SECTOR  
                    DEPARTMENT
    Division contain Sector and Sector contain Department so resulting report becomes something like following. A figure is being shown against each Department and I want to show SUBTOTAL of each Sector right against Sector column (by adding all Department coming
    under it) and then show TOTAL of Division (by adding all Department or all Sector) at the end. How do I show these totals? 
        Division1
             Sector1               SUBTOTAL HERE (for e.g. 19,000)
                  Department1      10,000
                  Department2      9,000
             Sector2               SUBTOTAL HERE  (for e.g. 8,000)
                  Department3      8,000
             Sector3               SUBTOTAL HERE  (for e.g. 13,000)
                  Department4      10,000
                  Department5      1,000
                  Department6      2,000
                                   TOTAL HERE  (for e.g. 40,000)
        Division2
             Sector4               SUBTOTAL HERE (for e.g. 3,500)
                  Department7      3,500
                                   TOTAL HERE (for e.g. 3,500)
    My report is displaying all divisions, sectors and departments with figures like above (I am using groups ) but how do I display SUBTOTAL and TOTAL?

    Hi ,
    You can use add total in this case.
    use below link;
    http://msdn.microsoft.com/en-in/library/ms170712.aspx
    To add totals to a report
        Switch to Design view.
        Right-click the data region cell that contains the field [LineTotal], and click Add Total.
        This adds a row with a sum of the dollar amount for each order.
        Right-click the cell that contains the field [Qty], and click Add Total.
        This adds a sum of the quantity for each order to the totals row.
        In the empty cell to the left of Sum[Qty], type the label "Order Total".
    To add a daily total to a report
        Right-click the Order cell, point to Add Total, and click After.
        This adds a new row containing sums of the quantity and dollar amount for each day, and the label "Total" in the Order column.
        Type the word Daily before the word Total in the same cell, so it reads Daily Total.
        Select the Daily Total cell, the two Sum cells and the empty cell between them.
    To add a grand total to a report
        Right-click the Date cell, point to Add Total, and click After.
        This adds a new row containing sums of the quantity and dollar amount for the entire report, and the Total label in the Date column.
        Type the word Grand before the word Total in the same cell, so it reads Grand Total.
        Select the Grand Total cell, the two Sum cells and the empty cells between them.
    Thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem.

Maybe you are looking for

  • Why am I forced to upgrade to FF5 without any notification?

    So I noticed today that somehow I got magically upgraded to FF5 ... I noticed this after FF kept crashing in Gmail and I started investigating... So I download FF4 and install it. In the Help/About there is a handy "Check for Updates" button. Since I

  • Windows 7 Ultimate Does Not Recognize Tungsten E2

    After I upgraded to Windows 7 Ultimate, Windows will not recognize my Tunsten E2 cable in the USB port.  I went to the Device Manager to look for a triangle in order to use Aceeca.  However, there is no triangle. I tried using a USB Drive in the USB

  • Why do I get an error message when I put in my redemption code?

    Maryland Institute College of Art and Design allows their students to download a yearly subscription to Adobe Creative Suite using an intermediary website mica.onthehub.com. Following the instructions I obtained my new redemption code and was directe

  • Why are my replies to emails being sent as attachments instead of continuous threads?

    When I reply to or forward an email it is being sent as an attachment instead of a thread. I want people to be able to read all the replies without having to open an attachment. I don't have this problem when I use I.E. 9 or 10. Can't find any settin

  • Oracle Apps 11i Cloning with +ASM 10g Database

    Hi, Can somebody help Apps cloning on the issue facing. Please provide in detailed process Apps Cloning with +ASM. Trying to Clone 11i Apps environment(11.5.10.2) and Db 10.2.0.4. The database is on +ASM. 1. Copied all the application files from SOUR