ALV grid total andsub-total

hi there...I know there´s a lot of posts about this subject but i didn't find what i´m looking for...
I want to know if there´s some way to give a total and a sub-total of a field, but instead of the total and subtotal sums I just want a count of the number of rows for the field that I've sorted.
FIELDCATALOG-FIELDNAME   = 'BUKRS'.
  FIELDCATALOG-SELTEXT_M   = 'BUKRS'.
  FIELDCATALOG-COL_POS     = 0.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'BUTXT'.
  FIELDCATALOG-SELTEXT_M   = 'BUTXT'.
  FIELDCATALOG-COL_POS     = 1.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'LIFNR'.
  FIELDCATALOG-SELTEXT_M   = 'LIFNR'.
  FIELDCATALOG-COL_POS     = 2.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'NAME1'.
  FIELDCATALOG-SELTEXT_M   = 'NAME1'.
  FIELDCATALOG-COL_POS     = 3.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'MBLNR'.
  FIELDCATALOG-SELTEXT_M   = 'MBLNR'.
  FIELDCATALOG-COL_POS     = 4.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'MJAHR'.
  FIELDCATALOG-SELTEXT_M   = 'MJAHR'.
  FIELDCATALOG-COL_POS     = 5.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'CPUDT'.
  FIELDCATALOG-SELTEXT_M   = 'CPUDT'.
  FIELDCATALOG-COL_POS     = 6.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'BUDAT'.
  FIELDCATALOG-SELTEXT_M   = 'BUDAT'.
  FIELDCATALOG-COL_POS     = 7.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'USNAM'.
  FIELDCATALOG-SELTEXT_M   = 'BUDAT'.
  FIELDCATALOG-COL_POS     = 8.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'MENGE'.
  FIELDCATALOG-SELTEXT_M   = 'MENGE'.
  FIELDCATALOG-COL_POS     = 9.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
  FIELDCATALOG-FIELDNAME   = 'DMBTR'.
  FIELDCATALOG-SELTEXT_M   = 'DMBTR'.
  FIELDCATALOG-COL_POS     = 10.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.
*          SORT
  WA_SORT-SPOS = 1.
  WA_SORT-FIELDNAME = 'BUKRS'.
  WA_SORT-TABNAME = 'ITAB'.
  WA_SORT-UP = 'X'.
  WA_SORT-SUBTOT = 'X'.
  APPEND WA_SORT TO IT_SORT.
  CLEAR WA_SORT.
  WA_SORT-SPOS = 2.
  WA_SORT-FIELDNAME = 'LIFNR'.
  WA_SORT-TABNAME = 'ITAB'.
  WA_SORT-UP = 'X'.
  WA_SORT-SUBTOT = 'X'.
  APPEND WA_SORT TO IT_SORT.
  CLEAR WA_SORT.
in the alv i want to know the number of rows for each value of lifnr (sub-total) and in the end the total of the all values of lifnr
thanks

Hi,
It is better to obtain this information not in ALV but working on the table. Using control level processing it is easy to achieve.
data: begin of it_overview occurs 0
          lifnr type ..
          tot_item type i,     "number of lifnr withing subtotal
        end of it_overwiev.
data: pos type i.   "to remember the position.
"your output table
Loop at it_ouptut.
   at new lifnr.
      pos = sy-tabix.    "remember first position of new LIFNR
   endat.
   at end of lifnr.
      it_overview-lifnr = it_output-lifnr.
      it_overview-tot_item = sy-tabix - pos.    "calculate how many within one LIFNR
      append it_overview.                             "store it in the table
       clear pos.
   endat.
endloop.
this way table IT_OVERVIEW stores LIFNRs and number of items forming their subtotals.
To get total use:
DESCRIEBE TABLE it_output.
it_output-lifnr = 'TOTAL_ITEMS'.    "total items within all LIFNRs
it_output-tot_item = sy-tfill.            "is equal to total lines in the table
append it_output.
Regards
Marcin

Similar Messages

  • Move sign to left of quantity on alv grid with & stil total quantity column

    Hi Guys,
    Here is my problem..  I have a column on my alv grid that is signed.  I want the sign to appear to the left of the number. 
    This column needs to be totalled so I can't use the function module CLOI_PUT_SIGN_IN_FRONT.  I've also tried (as per forum thread) having the field type as TABHIST-DELRATE but this rounds the values and the sign is still on the wrong side.
    Any ideas would be gratefully received..
    Regards,
    Liz.

    I think first you need to read
    1. USR01-DCPFM for user default decimals values, by giving user sy-uname then go to
    2. DDVAL giving USR01 & DCPFM you will get domain values
    if domain values X or Y or space arrange the EDIT_MASK accordingly and pass to field catalog.
    ( Here you can also use fm DOMAIN_VALUE_GET)
    May this will you out.

  • Add a count to an ALV grid of the total number of lines

    Hi There
    I have a really long ALV report which prints lots of records. How can I add a total number of records count to appear in the header?
    I use the Grid display function to call the ALV grid.
    Any help appreciated

    Hi,
    You can do as below :
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    Thanks,
    Sriram Ponna.

  • ALV grid report - Download total to excel

    Hi,
    In ALV report I am calculating Gross profit%.
    *Gross profit%  = ( (NetValue- Cost value) * 100 )/ CostValue.*
    Report strcture is as below.
    Region     Article             Netvalue      CostValue    Grossprofit%
        A       1        100          80            25
        A      2        150          140          7.14
    total                             250          220     13.64     
    In total i am calulating Gross profit over Total-Netvalue and Total-Costvalue.
    report is working fine but while downloading data in excel or any other format, Gross profit%  in Total row comes up as summation of all the rows. for example if i download above records grossprofit% will be 32.14 which is  wrong.
    Please suggest.

    it.s normal,
    please deactivate option sum on excel file.
    regards
    r

  • ALV GRID Using FM : Total,Avg,Avg/MT

    Hi Forum,
    I have gone through several posts on sum,avg in alv but could not find exactly what i'm looking for
    so here its goes:
         BILL     BAG     MT     MRP     Retension     TAXABLE VALUE     BILL VALUE
         1     20     1     200     4000             500                             4500
         2     40     2     200     8000             1000                             9000
         3     60     3     200     12000     1500                             13500
         4     80     4     200     16000     2000                             18000
         5     100     5     200     20000     2500                              22500
         6     120     6     200     24000     3000                              27000
         7     140     7     200     28000     3500                              31500
         8     160     8     200     32000     4000                              36000
         9     180     9     200     36000     4500                              40500
    Total          900     45     200     180000     22500                      202500
    Average     100     5     200     20000     2500                              22500
    Average MT               4000            500                              1012.5
    I want exactly the senario shown above Total/Avg/AVg/MT under the same column,
    Now if this is possible ,how can i achieve this??
    I tried a lot to preserve the tabular format but there is something wrong with website i always distorts the tabular format.
    Thanks & Regards

    Hi Jaker 
    Try calling cl_gui_alv_Grid->refresh_table_display.
    refresh table display when ever the qty is changed.
    It should work.
    Venkat.

  • TO enable the menu button in ALV Grid Display

    Hi Mates,
    I have a peculiar problem while doing ALV Grid display for screens.
    In the main Screen i have Three coloumns.The 1st coloum will interacted
    next screen 101 and 2nd coloum will interacted to screen 102.
    Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen
    101 and same button is disabled in screen 102.
    But the code semms to be fine .
    Below i have pasted the code and please have a look and help to come out of this cris.
    My Code  :
    FORM CREATE_ALV_GRID USING R_SCREEN.
      DATA: LS_LAYOUT TYPE LVC_S_LAYO,
      ITAB_FUNCTIONS     TYPE UI_FUNCTIONS.   "MHTK903257(+)(add)
      CASE R_SCREEN.
    *--> SCREEN 9000
        WHEN C_SCREEN_9000.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' 'WADAT'     'Due date'(004)  'X' 'D' ' ' ' ' ' ' 'C100',
    *'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500',  "MHTK903257(-)
    'ITAB_OVERVIEW' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:
    'ITAB_OVERVIEW' 'EST_TO'    'Estim TO'(030)    ' ' 'I' ' '  ' ' ' ' 'C500'.
          LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'.  "MHTK903418
            ENDLOOP.
          LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1000
            EXPORTING
              I_PARENT  = PT_DOCK_1000.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1000
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_OVERVIEW
              IT_FIELDCATALOG = ITAB_FIELDCAT_9000.
    *--> SCREEN 9100
        WHEN C_SCREEN_1100.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETIAL' 'WAUHR'     'Due time'(007)  ' ' 'T' ' ' 'X' ' ' 'C100',
    'ITAB_DETAIL' 'TOT_TO'    'Total TO'(006)   'X' 'I' ' '  ' ' ' ' 'C30',
    'ITAB_DETAIL' 'EST_TO'    'Estim TO'(030)   ' ' 'I' ' '  ' ' ' ' 'C500'.
       CLEAR ITAB_INB_LOC.
        LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.
             CHECK SY-SUBRC EQ 0.
                PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
       ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
            'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME
            ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.
         ENDLOOP.
         CLEAR: ITAB_STORAGE_TYPE.
          LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.
            CHECK SY-SUBRC EQ 0.
            PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
                                        USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME
      ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
          ENDLOOP.
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1100
            EXPORTING
              I_PARENT  = PT_DOCK_1100.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS   "MHTK903257(+)(add)
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1100
                                     CHANGING LS_LAYOUT-GRID_TITLE.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_DETAIL
              IT_FIELDCATALOG = ITAB_FIELDCAT_1100.
    screen 1300 TO detail.
    *--> SCREEN 9300
        WHEN C_SCREEN_1300.
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_TO2' 'TANUM' 'TO'(020)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_TO2' 'NLPLA' 'Location'(021) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'LETY1' 'SUT'(013)  ' ' 'C'  ' ' ' ' ' ' 'C500',
    'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    *'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1300
            EXPORTING
              I_PARENT  = PT_DOCK_1300.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1300
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_TO2 BY TANUM VBELN POSNR.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_TO2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1300.
    screen 9400 Pre Processing detail.
    *--> SCREEN 9400
        WHEN C_SCREEN_9400.          "MHTK903418(BEgin Of change)
    *-- Build the field catalog for the ALV grid.
          PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400
                                      USING:
    *ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
    'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030)  ' '   'C' ' ' ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' '   'C' ' '  ' ' ' ' 'C100',
    'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' '   'C' ' '  ' ' ' ' 'C500',
    'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' '   'C' ' '  ' ' ' ' 'C500'.
    *'ITAB_TO2' 'MATNR' 'Material'(016) ' '  'C' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' '  ' ' ' ' 'C500',
    *'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' '  ' ' ' ' 'C500'.  "MHTK903257(-)
    **'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'.       "MHTK903257(-)
    *-- Create the ALV grid object.
          CREATE OBJECT PT_ALV_1400
            EXPORTING
              I_PARENT  = PT_DOCK_1400.
    *-- Exclude the non-applicable functions from the ALV grid.
          PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
                                    USING  R_SCREEN.
    *-- Get the title of the ALV grid.
          PERFORM GET_ALV_GRID_TITLE USING    C_SCREEN_1400
                                     CHANGING LS_LAYOUT-GRID_TITLE.
          SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.
    *-- Display the ALV grid.
          CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              IS_LAYOUT       = LS_LAYOUT
              IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
            CHANGING
              IT_OUTTAB       = ITAB_PRE_PROC2
              IT_FIELDCATALOG = ITAB_FIELDCAT_1400.  "MHTK903418(End of change)
      ENDCASE.

    Hi
    U copy from standard program and paste ur report ...It will work..'
    Regards:
    Prabu

  • 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

  • Total Field in ALV Grid

    Can i change the values in total column in ALV Grid program. I had made one report with 3 hirerchy level and for first hirerchy i need different total values just for one column as total values are misleading the users. is it possible to change the value total field in ALV?

    hi
    make the fields for which u r displaying total as editable.
    so when ever u make changes in the column,
    see the sample code, i have done a similar program
    FORM DATA_CHANGED_MATRIX USING P_ER_DATA_CHANGED TYPE REF TO
    CL_ALV_CHANGED_DATA_PROTOCOL P_ONF4 type C E_UCOMM TYPE SY-UCOMM.
      DATA: VALUE LIKE YRECORDINGD_QDMS-SCORE.
      CLEAR VALUE.
      data: begin of wa_tot,
      TOTAL_SCORE like yrecordingd_qdms-score,
      end of wa_tot.
      DATA: BEGIN OF WA_DATA,
      SRNO type i,
      LOCATION LIKE YCONCERNS_QDMS-LOCATION,
      LOC_DESC LIKE YLOCATION_QDMST-LOC_DESC,
      TOTAL_SCORE LIKE YRECORDINGD_QDMS-SCORE,
      END OF WA_DATA.
      FIELD-SYMBOLS: <LS_VALUE1> TYPE ANY,
      <LS_VALUE2> TYPE ANY.
      DATA: L_VALUE TYPE LVC_VALUE,
      ls_mod_cell type lvc_s_modi.
      SORT P_ER_DATA_CHANGED->MT_MOD_CELLS BY ROW_ID.
      LOOP AT P_ER_DATA_CHANGED->MT_MOD_CELLS INTO LS_MOD_CELL.
        CALL METHOD P_ER_DATA_CHANGED->GET_CELL_VALUE
          EXPORTING
            I_ROW_ID    = LS_MOD_CELL-row_id
            I_FIELDNAME = LS_MOD_CELL-fieldname
          IMPORTING
            E_VALUE     = L_VALUE.
        VALUE = L_VALUE.
        IF VALUE < 100.
          READ TABLE <TEMP_TAB> INTO <TEMP_WA> INDEX LS_MOD_CELL-ROW_ID.
          MOVE-CORRESPONDING <TEMP_WA> TO WA_TOT.
          WA_TOT-TOTAL_SCORE = WA_TOT-TOTAL_SCORE + VALUE.
          MOVE-CORRESPONDING WA_TOT TO <TEMP_WA>.
          MODIFY <TEMP_TAB> FROM <TEMP_WA> INDEX LS_MOD_CELL-ROW_ID.
          CALL METHOD GO_GRID->REFRESH_TABLE_DISPLAY.
        ELSE.
              CLEAR WA_DATA.
        ENDIF.
        CLEAR:WA_TOT,VALUE.
      ENDLOOP.
    ENDFORM.

  • 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

  • Total for a Numeric field in ALV Grid display

    Hi all,
    I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
    Regards,
    Balavardhan.K

    Check this code for subtotals and totals..
    REPORT ZYFI_REPT007
           NO STANDARD PAGE HEADING
           LINE-SIZE 300
           LINE-COUNT 50
           MESSAGE-ID ZYFI.
    TABLES : COOI, " Commitments Management: Line Items
             LFA1,                         " Vendor master (general section)
             VBEP,
             RKPLN.
          TABLE TYPES AND INTERNAL TABLES                                *
    DATA : BEGIN OF TYP_COOI ,
           OBJNR LIKE COOI-OBJNR,
           SAKTO LIKE COOI-SAKTO,
           MEGBTR LIKE COOI-MEGBTR,
           MEINH LIKE COOI-MEINH,
           WKGBTR LIKE COOI-WKGBTR,
           REFBN LIKE COOI-REFBN,
           RFPOS LIKE COOI-RFPOS,
           SGTXT LIKE COOI-SGTXT,
           BUDAT LIKE COOI-BUDAT,
           LIFNR LIKE COOI-LIFNR,
           END OF TYP_COOI.
    DATA : BEGIN OF TYP_LFA1 ,
            LIFNR LIKE LFA1-LIFNR,
            NAME1 LIKE LFA1-NAME1,
           END OF TYP_LFA1.
    DATA : BEGIN OF IT_OUTTAB OCCURS 0,
             OBJNR LIKE COOI-OBJNR,
             SAKTO LIKE COOI-SAKTO,
             MEGBTR LIKE COOI-MEGBTR,
             MEINH LIKE COOI-MEINH,
             WKGBTR LIKE COOI-WKGBTR,
             REFBN LIKE COOI-REFBN,
             RFPOS LIKE COOI-RFPOS,
             SGTXT LIKE COOI-SGTXT,
             BUDAT LIKE COOI-BUDAT,
             LIFNR LIKE COOI-LIFNR,
             NAME1 LIKE LFA1-NAME1,
           END OF IT_OUTTAB.
    DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
           IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
    *-- ALV Declarations
    TYPE-POOLS SLIS.
    DATA: IT_EVENTS            TYPE SLIS_T_EVENT,
          GS_EVENT             TYPE SLIS_ALV_EVENT,
          wa_fldcat            type slis_fieldcat_alv.
    DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GT_PRINT TYPE SLIS_PRINT_ALV.
    DATA: IT_FLDCAT       TYPE SLIS_T_FIELDCAT_ALV.
    DATA: IT_SORT             TYPE SLIS_T_SORTINFO_ALV.
    DATA: V_REPID LIKE SY-REPID.
                        SELECTION SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
                                           " Controlling Area
                     S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
                                           " Company code
                     S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
                                           " Fiscal Year
                     S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
                                                            " Internal order
                     S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
                                                              " Cost Element
                     S_BUDAT FOR COOI-BUDAT, " Debit Date
                     S_LIFNR FOR COOI-LIFNR. " Vendor
    SELECTION-SCREEN END OF BLOCK B1.
           S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
    *-- Read data
      PERFORM GET_DATA.
           E N D   O F   S E L E C T I O N                               *
    END-OF-SELECTION.
    *-- Process the data and prepare the output data
      PERFORM CALCULATE_FINAL_INFO.
    *--Display Report output
      PERFORM DISPLAY_REPORT.
          FORM CALCULATE_FINAL_INFO                                     *
        Process the data and prepare final internal table               *
    FORM CALCULATE_FINAL_INFO.
      DATA : L_OBJNR LIKE COOI-OBJNR.
      SORT IT_LFA1 BY LIFNR.
      DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
      LOOP AT IT_COOI.
        L_OBJNR = IT_COOI-OBJNR+2(20).
        SHIFT L_OBJNR LEFT DELETING LEADING '0'.
        IF L_OBJNR IN S_OBJNR.
          READ TABLE IT_LFA1 WITH KEY LIFNR  = IT_COOI-LIFNR.
          IF SY-SUBRC EQ 0.
            IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
          ENDIF.
          MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
          CLEAR IT_OUTTAB-OBJNR.
          IT_OUTTAB-OBJNR = L_OBJNR.
          APPEND IT_OUTTAB.
          CLEAR IT_OUTTAB.
          CLEAR IT_LFA1.
          CLEAR L_OBJNR.
        ENDIF.
      ENDLOOP.
    ENDFORM.
    *&      Form  GET_DATA
         Fetch the Data from the table COOI and LFA1
    FORM GET_DATA.
      SELECT OBJNR
            SAKTO
            MEGBTR
            MEINH
            WKGBTR
            REFBN
            RFPOS
            SGTXT
            BUDAT
            LIFNR
            FROM COOI
            INTO TABLE IT_COOI
            WHERE   BUDAT IN S_BUDAT
            AND LIFNR IN S_LIFNR
            AND KOKRS IN S_KOKRS
            AND BUKRS IN S_BUKRS
            AND GJAHR IN S_GJAHR
            AND SAKTO IN S_SAKTO.
      IF SY-SUBRC EQ 0 .
    Get the Vendor name from LFA1
        SELECT LIFNR
               NAME1
               FROM LFA1
               INTO TABLE IT_LFA1
               FOR ALL ENTRIES IN IT_COOI
               WHERE LIFNR EQ IT_COOI-LIFNR.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " GET_DATA
    *&      Form  DISPLAY_REPORT
           Display the output
    FORM DISPLAY_REPORT.
      PERFORM BUILD_CATALOG.
      PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
      IF NOT IT_OUTTAB[] IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM      = V_REPID
                  I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                  IT_FIELDCAT             = IT_FLDCAT
                  IT_SORT                 = IT_SORT
                  IT_EVENTS               = IT_EVENTS
             TABLES
                  T_OUTTAB                = IT_OUTTAB
             EXCEPTIONS
                  PROGRAM_ERROR           = 1
                  OTHERS                  = 2.
      ELSE.
        MESSAGE I999 WITH TEXT-013.
      ENDIF.
    ENDFORM.                               " DISPLAY_REPORT
    *&      Form  BUILD_CATALOG
          Build the Field catalog for the ALV Report
    FORM BUILD_CATALOG.
      DATA: V_INDEX LIKE SY-TABIX.
      V_REPID = SY-REPID.
      DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = V_REPID
                I_INTERNAL_TABNAME     = 'IT_OUTTAB'
                I_INCLNAME             = V_REPID
           CHANGING
                CT_FIELDCAT            = IT_FLDCAT
           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.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
                             TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC  EQ 0.
        WA_FLDCAT-DO_SUM  = 'X'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
                                TABNAME =  'IT_OUTTAB' INTO WA_FLDCAT.
      IF SY-SUBRC EQ 0.
         WA_FLDCAT-SELTEXT_L = 'Order'.
         WA_FLDCAT-COL_POS = 1.
         WA_FLDCAT-DDICTXT = 'L'.
        MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
      ENDIF.
      LS_SORT-FIELDNAME = 'OBJNR'.
      LS_SORT-SPOS      = 1.
      LS_SORT-UP        = 'X'.
      LS_SORT-SUBTOT    = 'X'.
      APPEND LS_SORT TO IT_SORT.
    ENDFORM.                               " BUILD_CATALOG
    *&      Form  FRM_PREPARE_EVENT_LIST
          Build the Events
    FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
      CLEAR GS_EVENT.
      GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
      GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
      APPEND GS_EVENT TO IT_EVENTS.
    ENDFORM.                               " FRM_PREPARE_EVENT_LIST
         TOP OF PAGE
    FORM TOP_OF_PAGE_REPORT.
      CALL FUNCTION 'Z_YREPORT_HEADER'
           EXPORTING
                DL_TITLE = SY-TITLE
                DL_REPID = SY-CPROG
                DL_LINSZ = SY-LINSZ
           EXCEPTIONS
                OTHERS   = 1.
    ENDFORM.                               " FRM_TOP_OF_PAGE_REPORT
    *&      Form  USER_COMMAND
      Drill Down Functionality to Call the Transaction ME23
    FORM USER_COMMAND USING    P_UCOMM    LIKE SY-UCOMM
                               P_SELFIELD TYPE SLIS_SELFIELD.
      DATA : L_INDEX LIKE SY-INDEX,
             L_REFBN LIKE COOI-REFBN.
      L_INDEX = P_SELFIELD-TABINDEX.       " holds the selected table index
      CLEAR L_REFBN.
      CASE P_UCOMM.
    *-- On Double Click
        WHEN '&IC1'.
          CLEAR L_REFBN.
    *-- Read the Current Line
          READ TABLE IT_OUTTAB INDEX L_INDEX.
          IF SY-SUBRC EQ 0.
            L_REFBN = IT_OUTTAB-REFBN.
            IF NOT L_REFBN IS INITIAL.
    *-- Set the BES Paramater Id to the Current line Purchase Order Number
              SET PARAMETER ID 'BES' FIELD L_REFBN.
    *-- Call the Transaction Purchase Order Display with the above PO Number
              CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
            ENDIF.
          ELSE.
            MESSAGE E999 WITH TEXT-014.
          ENDIF.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND

  • How to get Grand Total Text in ALV GRID

    Hi Folks,
    I am able to get the SUBTOTAL TEXT .....But i need...
    How to get Grand Total Text in ALV GRID Display...
    Can any one give a Solution for this...

    Hi Surendar,
    Check out this code.. this is showing Total Text in Toal line in the very first column.
    REPORT  zsales_ord_det_1                        .
    TABLES: ztable_10.
    TYPE-POOLS: slis.
    DATA: BEGIN OF it OCCURS 0,
    srno(6) type c,
    name LIKE ztable_10-name,
    age LIKE ztable_10-age,
    END OF it.
    DATA : BEGIN OF it_temp OCCURS 0,
    name LIKE ztable_10-name,
    age LIKE ztable_10-age,
    END OF it_temp.
    DATA: i_fieldcat  TYPE slis_t_fieldcat_alv,
          wa_fieldcat TYPE  slis_fieldcat_alv.
    DATA: v_repid LIKE sy-repid,
           i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
           gs_layout TYPE slis_layout_alv,
           gd_layout TYPE slis_layout_alv,
           i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
           wa_sort TYPE slis_sortinfo_alv.
    START-OF-SELECTION.
      v_repid = sy-repid.
      SELECT * FROM ztable_10 INTO TABLE it_temp.
      LOOP AT it_temp .
        it-srno = 'Total'.
        it-name = it_temp-name.
        it-age = it_temp-age.
        APPEND  it.
      ENDLOOP.
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         i_program_name               = v_repid
         i_internal_tabname           = 'IT'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
         i_inclname                   = v_repid
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = i_fieldcat[]
       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.
    wa_fieldcat-row_pos = 1.
    wa_fieldcat-col_pos = 1.
    wa_fieldcat-fieldname = 'SRNO'.
    wa_fieldcat-tabname = it.
    append wa_fieldcat to i_fieldcat.
      LOOP AT i_fieldcat INTO wa_fieldcat.
        IF wa_fieldcat-fieldname = 'AGE'.
          wa_fieldcat-do_sum = 'X'.
          MODIFY i_fieldcat FROM wa_fieldcat.
        ENDIF.
       IF wa_fieldcat-fieldname = 'SRNO'.
         Hide this field so that it can display it's content i.e.
            Total text in Subtotal level
        wa_fieldcat-tech = 'X'.
          wa_fieldcat-no_out = 'X'.
          MODIFY i_fieldcat FROM wa_fieldcat TRANSPORTING tech no_out.
       ENDIF.
      ENDLOOP.
    wa_sort-spos = 1.
    wa_sort-fieldname = 'SRNO'.
    wa_sort-up = 'X'.
    wa_sort-subtot = 'X'.
    APPEND wa_sort TO i_sort.
      gd_layout-no_totalline = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                       = ' '
         i_callback_program                        = v_repid
      I_CALLBACK_PF_STATUS_SET     = ' '
    i_callback_user_command                = '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                                      = gd_layout
         it_fieldcat                                      = i_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
         it_sort                           = i_sort
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it
       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.
    Regards,
    Seema

  • Custom total/subtotal formula in an ALV Grid and printing.

    I have an ALV grid using OOPs method (Class cl_gui_alv_grid). The table that I am displaying is a dynamic table.
    call method o_grid->set_table_for_first_display
        exporting
          is_variant      = gx_variant
          i_save          = 'A'
          is_layout       = gs_layout
        changing
          it_fieldcatalog = it_fldcat
          it_outtab       = <gt_tabletotal>.
    On one of the columns in the ALV grid, instead of the regular summation, I had to do weighted averages (not avg).
    I built a logic to manipulate this total field for that column using field symbols.
    CALL METHOD o_grid->get_subtotals
        IMPORTING ep_collect00 = total
                  ep_collect01 = subto.
    ASSIGN total->* TO <ftotal>.
    ASSIGN subto->* TO <fsubto>.
    CALL METHOD o_grid->refresh_table_display
       EXPORTING I_SOFT_REFRESH = '1' .
    I manipulated <ftotal>-mycustomformulafield field there using some logic.
    In my field catalog i have the above field with wa_it_fldcat-do_sum = 'X ' .
    Now, II am able to see my custom formula on the screen. But when I print the grid using the print button or when I export to an excel sheet(I use export to local file and then select excel there) , my custom formula that i calculated above is reset to 0.000 .
    (Also when I email the grid, my custom formula is wiped). How can I avoid this ? Any useful suggestion is well appreciated.

    Hi, Shareen,
    We have the same problema here.
    Could you solve it?
    Thanks in advance

  • ALV GRID TEXT in grand Total

    Hi friends,
        In ALV GRID I need to display text in total like grand Total not in subtotal.
    Please let me know the solution .
    Thanks in advance
    Rajendran

    Hi,
    R U using FM or Class.
    If you are using FM, Grand total cannot be produced. Only using classes we can display Grand Totals.
    Its my own experience.
    thanks

  • Total problem in Exporting ALV GRID to Excel

    Hi all,
    I have manipulated the Total of ALV Grid by using GET_SUBTOTALS and REFRESH method of CL_GUI_ALV_GRID. The ALV Output is also correct. When i export to Excel,only the Original total is displaying not the calculated one. How to download the exact output which is displaying in the ALV Grid to Excel.
    Please help me out to solve this.
    Thanks,
    Ramesh

    DEAR,
    AS U WANT UPLOAD WITH THE SUB TOTAL YOU TRY THIS.
    FIRST to get subtotal in ALV output you select at least one column of total and then press ctrl + F6 . u will see the sub total .
    and now how to download it so press  ctrl + shift + F9 .
    now screen appears and select second option ie spreadsheet and press enter
    now a screen appear  in wich u have to give file name.
    so double click on search button of file name . click on desktop  give ur file name as u want suppose zreport u have given.
    and save type = excel file.
    now save it and then generate it your output bytes will be transmitted .
    now u can see in your desktop in your file name . ur output with subtotal.
    regards
    navin

  • Total, Subtotal of a hidden column in an ALV grid

    I have a requirement for an ALV grid where I have to use a custom formula for a column's total and subtotal.
    This value is a function of another column which is hidden (No_out = 'X').
    I am unable to access the total and subtotal of this hidden column . I am able to access this only when I unhide the column in the field catalog.
    THis is how I access the total and subtotal of the GRID. I use oops ALV of the class CL_GUI_ALV_GIRD.
    call method o_grid->get_subtotals
        importing
          ep_collect00 = total
          ep_collect01 = subto.
      assign total->* to <ftotal>.
      assign subto->* to <fsubto>.
    I thought I would manipulate <ftotal>-mycolumn and <fsubto>-mycolumn . But both these are functions of a hidden column
    and <ftotal>-hiddencolumn and <fsubto>-hiddencolumn is always empty unless I unhide them. I cannot display these columns to users as they are just logical columns of a dynamic internal table I have built.  :-s

    HI,i have the same issue, how did you solve it?
    Regards.

Maybe you are looking for