In alvs how to do totals by colum wise and row wise

hi,
in alvs how to do totals by colum wise and row wise
could u plz explain clearly with coding

Hi Rajesh,
Go through these links...
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
Reward Points if this helps,
Satish

Similar Messages

  • Cell wise and row wise check box in oops alv

    Normally column wise check box are possible in oops alv but how to possible check box in first row only in oops alv and Cell wise check box in oops alv?

    Hi,
    Try like changing  this
    insted of
    g_layout-f2code = ' '.
    use this
    g_layout-f2code = 'DISP'. " Sets fcode for when double
    and
    g_layout-f2code = '&ETA'. " it will display POPUP screen
    Best Regards
    Ranga
    Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
    Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM

  • 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

  • HT204053 I am getting alot of spam in my ICloud email account.  How can I totally delete this account and start a new one

    I am getting alot of spam in my ICloud Email.   How can I totally delete my account and set up a totally new one?

    You might have some better luck if you call your country number from http://support.apple.com/kb/HE57 and ask to speak with the Account Security Team.

  • How to calclulate Total no.of employees in shift wise

    Dear Friends,
    How to calclulate Total no.of employees in shift wise,
    when im giving two input dates,the should be total no.of employees in shift wise.
    please give solution for me,
    Thanks,
    Mathan.

    Dear Mathankumar,
    If you are using LDB then based on date it will pick all employee.
    you mention the Infotype 0007(this will store shift Details) so that it will pick this infotype record.
    After that you can play with the records.
    Like using collect statement based on shift
    Regards,
    Chandrashekhar

  • How to check total cost of a materaial month wise

    Dear all,
             Can any one know how to check total expense of a material in a month.
    Thanks
    Arun

    Hi,
    You can make a custom report for this.
    If you want to know generally there is a head count report available in OM

  • How to get the current selected column and row

    Hi,
    A difficult one, how do i know which column (and row would also be nice) of a JTable is selected?
    e.g.
    I have a JButton which is called "Edit" when i select a cell in the JTable and click the button "Edit" a new window must be visible as a form where the user can edit the a part of a row.
    Then the column which was selected in the JTable must be given (so i need to know current column) and then i want the TextField (the one needed to be edited) be active with requestFocus(). So it would be
    pricetextfield.requestFocus();
    Problem now is that i have to click every time in the window the JTextField which was selected in the JTable. I have chosen for this way of editing because my application is multi-user and it would be too difficult for me when everybody did editing directly (catch signals, reload data, etc.).
    My question is how do I know the current column and the current row in a JTable?

    I'm not sure what your mean by the "current" row or column, but the following utility methods return
    which row and column have focus within the JTable.
    public static int getFocusRow(JTable table) {
        return table.getSelectionModel().getLeadSelectionIndex();
    public static int getFocusColumn(JTable table) {
        return table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
    }

  • How to add Total Quantity in Inbound and Outbound Delivery screen

    Hi,
    I want to add Total quantity field in Inbound and Outbound Delivery screens.
    In document flow i can see the line item quantities in ALV Format, but if i select Display the totals above the entry check box
    in Change Layout--> Display, i didn't see any totals displayed.
    Please help me on this?
    Regards
    Bhuvana

    Hi
    If the field is a customer field, see BADI 'LE_SHP_TAB_CUST_HEAD'
    Regards
    Eduardo

  • How to print total stock in smartform by material wise

    Dear Experts,
    I am trying to print total material stock which is issued and receipt during entered date in a smartform ,Here  I want to print totatl stock issued n receipt by material wise in seperate line .For that I fetch alldata and put into one internal table .In smartform I am using table for printing data.
    Edited by: BharatRathod on Mar 8, 2010 11:43 AM
    Edited by: BharatRathod on Mar 8, 2010 11:46 AM

    Hi,
    Try using the CALCULATIONS tab in the tables for printing the total stock in smartforms.
    Regards,
    Sharin.

  • How To calculate Total Number of Employee in shift wise

    Dear Gurus,
    my requirement is calculate the  total no.of employees  present & absent in shift wise.
    My output like this.
    Department                        Shift       Present           Absent
    Information Technology        GSFT       56                   24
    Engine Shop                       ASFT     124                   26
                                             BSFT      155                   45
                                                                                    CSFT       80                     20
    Thanks,
    Rajkumar.A

    Hi,
    You can make a custom report for this.
    If you want to know generally there is a head count report available in OM

  • ALV display column and row wise

    hi experts,
    Is it possible to display in ALV display as 6 fields in column and some ranges in row display so how to display that using alv grid any sample report please do send me.
    e.g.display format.
                   PO Type          Shipping Date          Invoice Num          PCS  #        Po No.          Cust Name          Terms          Open Balance
    Current                                                                           
    Total Current                                                                           
    1 - 15                                                                           
    Total 1 - 15                                                                           
    16-30                                                                           
    Total 16-30                                                                           
    31 - 60                                                                           
    Total 31 - 60                                                                           
    61 - 90                                                                           
    Total 61 - 90                                                                           
    > 90                                                                           
    Total > 90                                                                           
    TOTAL

    hi Lakshman,
    i want report for customer open invoices that is aging report,
    so depens on due days as per ranges shown in my question like 1--15 days,
    15-16 days these are due days ranges , and i have display these related ranges records horizontally , just understand my display format u will get what i mean to say,
    please send me any proper solution.
    Thanks and Regards,
    Yogesh

  • How to calculate value from perticular column and row in pivot table

    Hi all,
    I am having following pivot table.
    Country
    A
    B
    C
    D
    F
    G
    H
    J
    K
    L
    M
    Grand Total
    Canada
    1
    1
    3
    3
    12
    14
    13
    97
    China
    8
    4
    3
    19
    India
    2
    47
    448
    176
    395
    3656
    1964
    1360
    8077
    USA
    1545
    352
    380
    26
    10
    4
    8
    32
    2054
    1023
    758
    4624
    UK
    12
    19
    13
    23
    33
    298
    Grand Total
    1545
    352
    381
    29
    72
    474
    184
    427
    5743
    3028
    2167
    13114
    Now I want sum of Columns A, B, C, K, M where Country = India in one field.
    and sum of D, F, g in another field. and sum of remainig columns in another field.
    How can i get sum of values with some where condition in pivot table.
    Thanks,

    Hi Michael,
    Following is the representation which i want
    CouRntry
    ROW LABLES
    A
    B
    C
    Total of
    ABC
    F
    G
    Total
    Of FG
    J
    K
    L
    TOTAL
    of JL
    Grand
    Total
    Canada
    1
    1
    3
    3
    12
    14
    13
    97
    China
    8
    4
    3
    19
    India
    2
    47
    448
    176
    395
    3656
    1964
    1360
    8077
    USA
    1545
    352
    380
    26
    10
    4
    8
    32
    2054
    1023
    758
    4624
    UK
    12
    19
    13
    23
    33
    298
    Grand Total
    1545
    352
    381
    29
    72
    474
    184
    427
    5743
    3028
    2167
    1
    Also if i get sum how can i add a column in between of the fields.
    Thanks

  • How to change colors of table col and row header?

    Could I change table header colors when run vi ? Is such a thing possible?
    ex: Header words color from black changed to green in column 2 of table.

    cloud a écrit:
    ...But I mean is "How to change header words color" not changed cell words color.
    tst gave you the answer ! A header cell is just a cell with a -1 value as index...
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Ordering row wise totals in a column.

    Hi,
    I have a report in Pivot view having two columns namely Count and Category. I have to apply sort on these two columns-first on Count and then on Category.
    The Total Count is also calculated row wise. Now when I apply sort on count column, only the values in that column are being sorted and not according to row wise total count. But my requirement is to sort the total count row wise first and then by Category.I am unable to do so.
    Kindly provide me the solution to this problem.
    Thanks
    Ankita

    Use RunningSum() function.
    Regards,
    Rohit

  • How to get total in ALV report in same Internal table?

    Data : Begin of it_data,
            kunnr type kunnr,
            name1 type name1,
            amt1  type btrt01, " CURR 15,2
           end of it_data.
    loop at it_data into wa_data
    endloop.      
    Hello friends,
    I am developing one ALV report with 20 rows.
    I have filled one internal table with some fileds like amount.
    I want to get total of all amount1 in AMT1 field.
    So, How to get total of amount in same internal table in ALV report ?
    It is ok if i get duplicate rows in internal table.
    Points 'll be awarded soon.
    Regards,
    NVM

    Hi Ronny,
    the alv output will display the sum at the last row.
    for this functionality u have do this logic.
    data: lw_fcat type slis_fieldcat_alv.
    data: lt_fcat type slis_t_fieldcat_alv/
    wa_fcat-fieldname = 'AMT1'.
    wa_fcat-tabname = 'ITAB'.
    wa_fcat-do_sum = 'X'.
    append wa_fcat to lt_fcat.
    and then pass it to reuse_alv_grid_display function,
    regards,
    Santosh Thorat

Maybe you are looking for

  • Question on updating a table based on report data

    Hi all, I am building a new stock request form for our site and I have a report that provides a listing of all requests that have a status of pending based on supv_approve flag being Null. I want to be able to update the table BGNA_NEW_STOCK_REQUESTS

  • Having Macbook Pro sleep/fan Issues

    SUMMARY: Macbook Pro eventually loses ability to sleep properly, will begin to constantly wake with fans at full speed and then quickly go back to sleep, back and forth every 30 seconds while the lid is closed. Restarting fixes the issue but it alway

  • Imported Photos (some) missing

    I "Imported" photos from folders then removed folders (as didn't need two copies!). Now in iPhotos, SOME are found and others not. As these were done at the same time how can the odd one not be found?

  • ORA-01410 when selecting data via ROWID

    hi there, after update on 11.2.0.2 we are getting the following error in our application when selecting a record using the comparison via the ROWID: select s.rowid , S.VRZNG_ENHT_TITEL from vws_vrzng_enht_haupt_sys s where s.rowid='AAASN0AAFAAACBUAAB

  • As Of Today iTunes Doesn't Recognize iPad2

    What is going on?   Tried just about anything, Finally got it to connect after several reboots of both the iPad and Windows and transferred a purchase but then the backup froze solid and after that I couldn't connect at all. At one stage it told me t