Just the sub totals in ALV ... is it possible

Report RCATS_APPROVE_ACTIVITIES
transaction called cats_appr_lite that displays a ALV report output
This report displayes the employees entered times in CATS and can be used by HR admins or managers for approval.
When the manager executes the report shows the times for each day
like it will show
PERN Date Time Unit
1000 1st jan monday 8 hours
1000 2nd jan monday 8 hours
1000 3rd jan monday 8 hours
1000 4th jan monday 8 hours
1000 5th jan monday 8 hours
And after i set the totals / sub totals for PERNR it also shows me another line
1000 40 hours
In this ALV report I just want to see the totals line like
1000 40 hours
and not the line items.
Idela scenario is I want to see the line items when clicked on the Totals line
1000 40 hours
Like i double click on the totals and see
1000 1st jan monday 8 hours
1000 2nd jan monday 8 hours
1000 3rd jan monday 8 hours
1000 4th jan monday 8 hours
1000 5th jan monday 8 hours
and from there on I can further navigate as required and currently avialable.
IS this something thatsome has every worked on. IS it technicallyfeasible with ALV reporting to show just the sub totals on the first page ( that is by not modifying the program but by just changing the layouts).

You can achieve this with the layouts:
First run your ALV.. now do the subtotal based on your employe... you will have
new line with * in front of it.
1000 1st jan monday 8 hours
1000 2nd jan monday 8 hours
1000 3rd jan monday 8 hours
1000 4th jan monday 8 hours
1000 5th jan monday 8 hours
*1000 40 hours
Click on this astrick ... it will collepse the line items...
Now, save you layout by pressing the "Save layout" button.
Next time run your report with this newly crated layout.
Regards,
Naimesh Patel

Similar Messages

  • Hide grand total field on ALV report, But keep the sub total fields

    Dear Experts,
    1) How to hide grand total field on ALV report, But keep the sub total fields.
    2) How to populate rate per ton & calculate total price according to the qty in delivering document.

    Dear Experts,
    1) How to hide grand total field on ALV report, But keep the sub total fields.
    2) How to populate rate per ton & calculate total price according to the qty in delivering document.

  • Color the sub-total row in an alv-grid

    Hi all.
    I work on SAP 4.7 WAS6.20 and output a table with the cl_gui_alv_grid. I´m able to color special rows (or columns) in the alv grid. But I want to color individually the sub-total lines (like the lines before) and don´t want the yellow color for all of the sub-total lines.
    Do you know how to color the sub-total-lines?
    Thanks a lot.
    Michael

    Hi,
    U can color an individula row see the link below
    Color a line
    The steps for coloring a line i the grid is much the same as making a traffic light.
    * To color a line the structure of the  table must include a  Char 4 field  for color properties
    TYPES: BEGIN OF st_sflight.
            INCLUDE STRUCTURE zsflight.
    *       Field for line color
    types:  line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    * Loop trough the table to set the color properties of each line. The color properties field is
    * Char 4 and the characters is set as follows:
    * Char 1 = C = This is a color property
    * Char 2 = 6 = Color code (1 - 7)
    * Char 3 = Intensified on/of = 1 = on
    * Char 4 = Inverse display = 0 = of
         LOOP AT gi_sflight INTO g_wa_sflight.
          IF g_wa_sflight-paymentsum < 100000.
            g_wa_sflight-line_color    = 'C610'.
          ENDIF.
          MODIFY gi_sflight FROM g_wa_sflight.
        ENDLOOP.
    * Name of the color field
    gs_layout-info_fname = 'LINE_COLOR'.
    * Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
          EXPORTING i_structure_name = 'SFLIGHT'
                                 is_layout                = gs_layout
          CHANGING  it_outtab                 = gi_sflight
    see the link
    http://www.sapgenie.com/abap/controls/alvgrid.htm

  • URGENT:-Regarding sub-total in alv code

    Hi,
    i had made dis report and it is working fine but now i want to add the sub total feature in dis report as it is the new requierment of report.
    plzz help me out by providing the code of sub-total feature in dis report .
    Help will be definately rewarded. here is d code of report:-
    TABLES: ISEG,MARA.
    TYPE-POOLS : SLIS.
    DATA : DATE1(15) TYPE C,
    DATE2(15) TYPE C,
    TITLE(65) TYPE C,
    DT(25) TYPE C.
    DATA : ITEVENT TYPE SLIS_T_EVENT.
    DATA: lv_sort TYPE slis_sortinfo_alv,
          t_sort type slis_t_sortinfo_alv.
    DATA : repid LIKE sy-repid.
    INTERNAL TABLE FOR INVENTORY STOCK *****************
    DATA: BEGIN OF ITS1 OCCURS 0,
          MATNR LIKE ISEG-MATNR,
          ITEMID(6) TYPE C,
          MEINS LIKE ISEG-MEINS,
          MENGE LIKE ISEG-MENGE,
          WRTZL LIKE ISEG-WRTZL,
          BUCHM LIKE ISEG-BUCHM,
          WRTBM LIKE ISEG-WRTBM,
          WERKS LIKE ISEG-WERKS,
          BUDAT LIKE ISEG-BUDAT,
          ZLDAT LIKE ISEG-ZLDAT,
          MTART LIKE MARA-MTART,
          ITEMDESC LIKE MAKT-MAKTX,
          DIFFQTY LIKE ISEG-BUCHM,
          DIFFVALUE LIKE ISEG-WRTBM,
          GRUND LIKE ISEG-GRUND,
          GRTXT LIKE T157E-GRTXT,
          BWART LIKE T157E-BWART,
          REAS TYPE C LENGTH 15,
          END OF ITS1.
    data: t_heading type slis_t_listheader.
    SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
    *SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    *********PARAMETERS*********
    PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT OBLIGATORY NO-EXTENSION,
                     M_TYPE  FOR MARA-MTART,
                     IT_M FOR MARA-MATNR.
    *********DEFINING VARIABLES*********
    SELECTION-SCREEN END OF BLOCK par1.
    CONCATENATE R_DATE-LOW6(2) '.' R_DATE-LOW4(2) '.' R_DATE-LOW+0(4) INTO DATE1.
    CONCATENATE R_DATE-HIGH6(2) '.' R_DATE-HIGH4(2) '.' R_DATE-HIGH+0(4) INTO DATE2.
    TOP-OF-PAGE.
      PERFORM PG_HEADER.
       START-OF-SELECTION.
      SELECT AMATNR AMEINS AMENGE AWRTZL ABUCHM AWRTBM AWERKS ABUDAT AZLDAT BMTART AGRUND CBWART
       FROM ISEG AS A INNER JOIN MARA AS B ON BMATNR = AMATNR
       INNER JOIN MSEG AS C ON AMBLNR = CMBLNR
       INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE BMATNR = AMATNR  AND BMEINS = AMEINS AND AWERKS = PLANT AND ABUDAT IN R_DATE AND BMTART IN M_TYPE AND BMATNR IN IT_M.
    SORT ITS1 BY MTART.
    LOOP AT ITS1.
         ITS1-ITEMID = ITS1-MATNR+12(6).
         ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
         ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
         SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
         SELECT SINGLE GRTXT INTO ITS1-GRTXT FROM T157E WHERE GRUND = ITS1-GRUND AND SPRAS = 'E' AND BWART = ITS1-BWART.
         MODIFY ITS1.
    ENDLOOP.
    PERFORM PRN_SMSTOCK_ALV.
    WRITING DATA FROM D TABLES**********
    FORM PG_HEADER.
    WRITE : 'INVENTORY REPORT             PLANT : ', PLANT.
    ENDFORM.
    *&      Form  PRN_SMSTOCK_ALV
          text
    -->  p1        text
    <--  p2        text
    form PRN_SMSTOCK_ALV .
    data: w_title   type lvc_title,
          w_repid   type syrepid,
          w_comm    type slis_formname,
          w_status  type slis_formname,
          x_layout  type slis_layout_alv,
          t_event   type slis_t_event,
          t_fieldcat type slis_t_fieldcat_alv,
          t_subtot TYPE slis_t_sortinfo_alv,
          subtot LIKE LINE OF t_subtot.
    refresh t_fieldcat.
    refresh t_event.
    refresh t_sort.
    clear x_layout.
    clear w_title.
      perform set_fieldcat2 using:
    1  'MTART'     'MTART'     'MARA'  '15'  space 'MATERIAL TYPE'        space  space  space space space space space space SPACE t_fieldcat 'L' 'L',
    2  'ITEMID'    'ITEMID'    'MARA'  '7'   space 'ITEM ID'              space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    3  'ITEMDESC'  'MAKTX'     'MAKT'  '25'  space 'MATERIAL DESCRIPTION' space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
    4  'MEINS'     'MEINS'     'MARA'  '5'   space 'UOM'                  space  space  space space space space space space SPACE t_fieldcat 'C' 'C',
    5  'MENGE'     'MENGE'     'ISEG'  '13'  space 'ORG.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    6  'WRTZL'     'WRTZL'     'ISEG'  '13'  space 'ORG.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    7  'BUCHM'     'BUCHM'     'ISEG'  '13'  space 'PHY.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    8  'WRTBM'     'WRTBM'     'ISEG'  '13'  space 'PHY.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    9  'DIFFQTY'   'MENGE'     'ISEG'  '13'  space 'DIFF.INV.QTY'         space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    10 'DIFFVALUE' 'WRTZL'     'ISEG'  '13'  space 'DIFF.INV.VALUE'       space  space  space space space space space space SPACE t_fieldcat SPACE 'P',
    11 'BUDAT'     'BUDAT'     'ISEG'  '18'  space 'CORRECTED DATE'       space  space  space space space space space space SPACE t_fieldcat  'C' 'C',
    12 'GRTXT'     'GRTXT'     'ISEG'  '18'  space 'REASON'               space  space  space space space space space space SPACE t_fieldcat  'L' 'L',
    13 'REAS'      'REAS'      'ISEG'  '18'  space 'AUTH.BY'              space  space  space space space space space space SPACE t_fieldcat  'C' 'C'.
    x_layout-zebra = 'X'.
    perform set_top_page_heading using t_heading t_event.
    perform set_events using t_event.
      w_status = ''.
      w_repid = sy-repid.
    w_comm   = 'USER_COMMAND'.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = w_repid
          it_fieldcat              = t_fieldcat
          i_Callback_top_of_page   = 'Top-of-page'
          is_layout                = x_layout
          it_sort                  = t_sort
          i_callback_pf_status_set = w_status
          i_callback_user_command  = w_comm
          i_save                   = 'X'
          it_events                = t_event
          i_grid_title             = w_title
          tables
          t_outtab                 = ITS1
          exceptions
          program_error            = 1
          others                   = 2.
    if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ENDFORM.
    FORM set_fieldcat2 USING
          p_colpos p_fieldname p_ref_fieldname p_ref_tabname
          p_outputlen p_noout
          p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
          p_hotspot p_showasicon p_checkbox p_edit
          p_dosum
        p_subtot
          t_fieldcat TYPE slis_t_fieldcat_alv
          P_JUST
          P_FTYPE.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
    General settings
      wa_fieldcat-fieldname = p_fieldname.
      wa_fieldcat-col_pos = p_colpos.
      wa_fieldcat-no_out = p_noout.
      wa_fieldcat-hotspot = p_hotspot.
      wa_fieldcat-checkbox = p_checkbox.
      wa_fieldcat-icon = p_showasicon.
      wa_fieldcat-do_sum = p_dosum.
    Set output length.
      IF NOT p_outputlen IS INITIAL.
        wa_fieldcat-outputlen = p_outputlen.
      ENDIF.
    Set text headers.
    IF NOT p_seltext_m IS INITIAL.
        wa_fieldcat-seltext_m = p_seltext_m.
    ENDIF.
    IF NOT p_seltext_l IS INITIAL.
        wa_fieldcat-seltext_l = p_seltext_l.
    ENDIF.
    IF NOT p_seltext_s IS INITIAL.
        wa_fieldcat-seltext_s = p_seltext_s.
    ENDIF.
      IF NOT p_reptext_ddic IS INITIAL.
        wa_fieldcat-reptext_ddic = p_reptext_ddic.
      ENDIF.
    IF NOT p_ddictxt IS INITIAL.
        wa_fieldcat-ddictxt = p_ddictxt.
    ENDIF.
      IF NOT P_JUST IS INITIAL.
        WA_FIELDCAT-JUST = P_JUST.
      ENDIF.
      IF NOT p_edit IS INITIAL.
        wa_fieldcat-Input     = 'X'.
        wa_fieldcat-edit     = 'X'.
        wa_fieldcat-do_sum = 'x'.
       wa_fieldcat-checkbox = 'x'.
       wa_fieldcat-hotspot = 'x'.
        ENDIF.
    APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    ======================== Subroutines called by ALV ================
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
         exporting
              it_list_commentary = t_heading.
    ENDFORM.
    form set_top_page_heading using t_heading type slis_t_listheader
                                    t_events  type slis_t_event.
    data: x_heading type slis_listheader,
          x_event   type line of slis_t_event.
    Report title
      clear t_heading[].
      clear x_heading.
      x_heading-typ = 'H'.
      x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
      append x_heading to t_heading.
    Plant Name
    clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'PLANT        : '.
      x_heading-info = PLANT.
      append x_heading to t_heading.
    IF DATE2 = '00.00.0000'.
      CONCATENATE DATE1 'to' DATE1 INTO DT SEPARATED BY SPACE.
    ELSE.
      CONCATENATE DATE1 'to' DATE2 INTO DT SEPARATED BY SPACE.
    ENDIF.
    X_heading-TYP = 'S'.
    X_heading-key = 'PERIOD         :'.
    X_heading-INFO = DT.
    APPEND x_heading TO t_heading.
    Control Date
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'CONTROL NO. :'.
      x_heading-info = ' ASDFADDFAAS  DATE : 11.04.2007'.
      append x_heading to t_heading.
    Top of page event
      x_event-name = slis_ev_top_of_page.
      x_event-form = 'TOP_OF_PAGE'.
      append x_event to t_events.
    endform.
    form set_events using t_events type slis_t_event.
    data: x_event   type line of slis_t_event.
    endform.
    Edited by: ric .s on Jan 29, 2008 5:21 AM

    Hi,
        U can do subtotal for a field based on some other field in ur ALV report using slis_t_sortinfo_alv.
    see the sample code below...
    data:  int_sort TYPE slis_t_sortinfo_alv,
              fs_sort TYPE slis_sortinfo_alv.
    Sort the output based on ORG UNIT.
      CLEAR fs_sort.
      fs_sort-fieldname = 'ORGEH'.
      fs_sort-subtot = 'X'.
      fs_sort-up = 'X'.
      APPEND fs_sort TO int_sort.
    perform f_alv_catsfieldcat.
    Fieldcat calculates the sum for SMPCNT field.
    FORM f_alv_catsfieldcat.
       DATA: loc_fieldcat TYPE slis_fieldcat_alv.
      DEFINE define_field.            
        clear loc_fieldcat.
        loc_fieldcat-fieldname = &1.
        loc_fieldcat-seltext_l = &2.
        loc_fieldcat-key = &3.
        loc_fieldcat-outputlen = &4.
        loc_fieldcat-do_sum = &5.
        append loc_fieldcat to int_fieldcat.
      END-OF-DEFINITION.
      REFRESH int_fieldcat.
      CLEAR int_fieldcat.
    define_field 'PERNR' text-029 'X' '8' ''.
    define_field 'ENAME' text-030 '' '40' ''.
    define_field 'KOSTL' text-037 '' '10' ''.
    define_field 'SMPCNT' text-040 '' '' 'X'. 
    endform.
    Then call REUSE_ALV-GRID_DISPLAY with ur internal table with int_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
              EXPORTING
                i_callback_program       = sy-repid
                i_callback_top_of_page   = 'TOP_OF_PAGE'
                it_sort                  = int_sort  
             i_callback_pf_status_set = 'F_PF_STATUS_SET'
                i_callback_user_command  = 'F_USER_COMMAND'
                it_fieldcat              = int_fieldcat
                i_save                   = 'X'
              TABLES
                t_outtab                 = int_outputcpy
              EXCEPTIONS
                program_error            = 1
                OTHERS                   = 2.
            IF sy-subrc <> 0.
              WRITE / 'error'.
            ENDIF.
    Hope it will help u..
    Reward points if helpful
    Cheers,
    Shanthi
    Edited by: shanthi ps on Jan 29, 2008 5:37 AM
    Edited by: shanthi ps on Jan 29, 2008 5:38 AM

  • Only sub total in alv report

    hi,
    I have a report on ALV with sub totals for some fields, it is working fine but my requirement is whether i can get only the sub totals of that report.
    regards,
    Prabhu

    HI
    refer this code.
    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.
    *END OF ZALV PROGRAM
    Reward all helpfull answers.
    Regards.
    Jay

  • Sub-totals in ALV Tree

    Hi Folks,
    Need your help.
    I have designed a report to be displayed in ALV tree. The report contains one column (Amount) which can be totaled using the SUM function of the ALV. The report is a 3 level hierarchy - Proj number, Plant and Proj type. When I select the Amount column and click on SUM button, I get the total value of Amount for that particular proj number.
    Now, what I want is,  a functionality to get the sub total of Amount on the basis of Proj type. Please advice me to get the desired functionality done.
    For more clarity please see the below scenario what I want -
    Proj number 12345
    ____Plant XYZ
    ________Proj type CA     100
    _______________ CA     100
    ________ subtotal            200
    ________ Proj type CE     150
    ________________CE     100
    ________subtotal            250

    After building fieldcatalog,use this
    data:    lt_sort            TYPE lvc_t_sort  ,
      ls_sort-fieldname = 'PROJECT'--> ur fieldname .
      ls_sort-spos      = '1' .
      ls_sort-subtot    = 'X' .
      ls_sort-up        = 'X' .
      APPEND ls_sort TO lt_sort .

  • Regarding sub totaling in alv

    hi,
    i am making report in alv in which i have to display the sub totals and den full total.
    is it possible to display sub total in ALV acccording to material type wise or itemid wise.
    plzz help me with some example.
    If find useful he or she will definately rewarded.........

    Hi, 
    The following example for sub totall for ALV  report..
    u have to pass do_sum = 'X'. for perticuler fileds.
    if it is use full answer reward me a points..
    *& Report  ZDEL_ALV1
    *Description:        This ALV interactive report is display Delivary
                       status
    REPORT  zdel_alv1 NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 60.
    *TABLE DECLARATION
    TABLES : likp,                     "Delivery Header Data
             lips,                     "Delivery item Data
             vbup.                     "sales document item status
    TYPE-POOLS : slis.
    *SRUCTURE DECLARATION
    *THIS TABLE FOR HEADER DETAILS
    TYPES : BEGIN OF t_likp ,
            vbeln LIKE likp-vbeln,     "Delivery number
            kosta like vbup-kosta,
            kunnr LIKE likp-kunnr,     "Customer number
            wadat LIKE likp-wadat,     "Planned goods movement date
            ernam LIKE likp-ernam,     "Name of person
            vkorg LIKE likp-vkorg,     "Sales organization
            lfart LIKE likp-lfart,      "DELIVERY TYPE
            ntgew LIKE likp-ntgew,      "NET WEIGHT
            END OF t_likp.
    *THIS TABLE FOR ITEM DETAILS
    TYPES : BEGIN OF t_lips ,
            vbeln LIKE lips-vbeln,     "Delivery number
            posnr LIKE lips-posnr,     "delivery item
            matnr LIKE lips-matnr,     "Material number
            lfimg LIKE lips-lfimg,     "Actual quantity delivered
            ntgew LIKE lips-ntgew,     "Net weight
            exbwr LIKE lips-exbwr,     "Externally entered posting amount
            arktx LIKE lips-arktx,     "Short text SO Item
            END OF t_lips.
    *THIS IS FOR FINAL OUTPUT
    TYPES : BEGIN OF t_vbup ,
            vbeln LIKE likp-vbeln,     "Delivery number
            kosta LIKE vbup-kosta,     "Picking status/Putaway status
            posnr LIKE vbup-posnr,     "delivery item
            matnr LIKE lips-matnr,     "Material number
            lfimg LIKE lips-lfimg,     "Actual quantity delivered
            ntgew LIKE lips-ntgew,     "Net weight
            exbwr LIKE lips-exbwr,     "Externally entered posting amount
            arktx LIKE lips-arktx,     "SHORT text SO Item
            description(20),           "for display text
            END OF t_vbup.
    *INTERNAL TABLES
    DATA : i_likp TYPE STANDARD TABLE OF t_likp.
    DATA : i_lips TYPE STANDARD TABLE OF t_lips.
    DATA : i_vbup TYPE STANDARD TABLE OF t_vbup.
    DATA : repid LIKE sy-repid.
    DATA : delivar1(10) TYPE c.
    *WORK AREA
    DATA : wa_likp TYPE t_likp.
    DATA : wa_lips TYPE t_lips.
    DATA : wa_vbup TYPE t_vbup.
    DATA:  i_vbup1 LIKE wa_vbup OCCURS 0 WITH  HEADER LINE.
    *SLIS TABLE DECLARATIONS
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv  WITH HEADER LINE,
          i_events TYPE slis_t_event,
          w_events TYPE slis_alv_event,
          i_fieldcat1 TYPE slis_t_fieldcat_alv  WITH HEADER LINE,
          i_layout TYPE slis_layout_alv.
    *SELECTING RANGE OF VALUES
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_vbeln  FOR likp-vbeln,
                     s_kunnr  FOR likp-kunnr,
                     s_wadat  FOR likp-wadat.
    SELECTION-SCREEN END OF BLOCK b1 .
    *CHOOSE ONE CHECK BOX FOR DISPLAYING THE DELIVARY STATUS
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : cb_kostc AS CHECKBOX,"DEFAULT 'X',
                 cb_kosta AS CHECKBOX,
                 cb_kostb AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b2.
    *INTIALIZATION CHECK
    INITIALIZATION.
      repid = sy-repid.
    *START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM get_field.
    PERFORM GET_EVENTS.
      PERFORM display.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *&      Form  RUCOMM
          This form getting details from lips table for displaying
           the item details and all select statements for delivary status
         -->R_UCOMM    text
         -->RS_SELFIELDtext
    FORM user_command USING r_ucomm LIKE sy-ucomm  rs_selfield TYPE
                                                   slis_selfield.
      IF rs_selfield-fieldname = 'VBELN'.
        delivar1 = rs_selfield-value.
      ENDIF.
      IF cb_kostc = 'X'.
      SELECT   VBELN KOSTA   FROM   VBUP
      INTO TABLE I_VBUP
      WHERE  VBELN IN DELIVAR
      AND KOSTA = 'C'.
      SELECT VBELN MATNR LFIMG EXBWR INTO TABLE I_LIPS FROM LIPS
                                        WHERE VBELN EQ DELIVAR1.
        REFRESH i_vbup1[].
        CLEAR i_vbup1.
        SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
        b~arktx
        INTO TABLE i_vbup
        FROM vbup AS a INNER JOIN lips AS b
        ON avbeln = bvbeln
        WHERE a~vbeln EQ delivar1
           AND kosta = 'C'.
      ELSEIF cb_kosta = 'X'.
      SELECT   VBELN KOSTA   FROM   VBUP
      INTO TABLE I_VBUP
      WHERE  VBELN IN DELIVAR
      AND KOSTA = 'A'.
        SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
        b~arktx
        INTO TABLE i_vbup
        FROM vbup AS a INNER JOIN lips AS b
        ON avbeln = bvbeln
        WHERE a~vbeln EQ delivar1
           AND kosta = 'A'.
      ELSEIF cb_kostb = 'X'.
        SELECT   VBELN KOSTA   FROM   VBUP
      INTO TABLE I_VBUP
      WHERE  VBELN IN DELIVAR
      AND KOSTA = 'B'.
        SELECT avbeln akosta bposnr bmatnr blfimg bntgew b~exbwr
        b~arktx
        INTO TABLE i_vbup
        FROM vbup AS a INNER JOIN lips AS b
        ON avbeln = bvbeln
        WHERE a~vbeln EQ delivar1
           AND kosta = 'B'.
      ENDIF.
      CLEAR i_vbup1.
      LOOP AT i_vbup INTO wa_vbup.
        i_vbup1-vbeln = wa_vbup-vbeln.
        i_vbup1-kosta = wa_vbup-kosta.
        IF wa_vbup-kosta = 'C'.
          i_vbup1-description = 'COMPLETELY PROCESSED'.
        ELSEIF wa_vbup-kosta = 'B'.
          i_vbup1-description = 'PARTIALLY PROCESSED'.
        ELSEIF wa_vbup-kosta = 'A'.
          i_vbup1-description = 'NOT YET PROCESSED'.
        ENDIF.
        i_vbup1-posnr = wa_vbup-posnr.
        i_vbup1-matnr = wa_vbup-matnr.
        i_vbup1-lfimg = wa_vbup-lfimg.
        i_vbup1-ntgew = wa_vbup-ntgew.
        i_vbup1-exbwr = wa_vbup-exbwr.
        i_vbup1-arktx = wa_vbup-arktx.
        APPEND i_vbup1 .
      ENDLOOP.
      SORT i_vbup1 BY vbeln matnr lfimg.
      DELETE ADJACENT DUPLICATES FROM i_vbup1 COMPARING vbeln matnr lfimg.
    SELECT VBELN MATNR LFIMG EXBWR INTO TABLE I_LIPS FROM LIPS
                                         WHERE VBELN EQ DELIVAR1.
    *This function module for displaying the item details
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = repid
          it_fieldcat             = i_fieldcat1[]
          i_callback_top_of_page  = 'TOP_OF_PAGE'
          i_callback_user_command = 'USER_COMMAND1'
          it_events               = i_events
        TABLES
          t_outtab                = i_vbup1
        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.
      CLEAR i_vbup1.
    ENDFORM.                    "RUCOMM
    *&      Form  USER_COMMAND1
          text
         -->R_UCOMM1   text
         -->RS_SELFIELDtext
    FORM user_command1 USING r_ucomm1 LIKE sy-ucomm  rs_selfield1 TYPE
                                                     slis_selfield.
      DATA: deliv(10) TYPE c.
      IF rs_selfield1 = 'VBELN'.
        deliv = rs_selfield1-value.
      ENDIF.
      SET PARAMETER ID 'VL' FIELD delivar1.
      CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    ENDFORM.                    "USER_COMMAND1
    *&      Form  GET_DATA
          This form for getting the data from likp table
    -->  p1        text
    <--  p2        text
    FORM get_data .
    SELECT VBELN KUNNR WADAT FROM LIKP INTO TABLE I_LIKP
                                     WHERE VBELN IN S_VBELN
                                     AND KUNNR IN S_KUNNR
                                     AND WADAT IN S_WADAT.
      REFRESH i_likp[].
      CLEAR i_likp.
      IF cb_kostc = 'X' AND cb_kosta = ' ' AND cb_kostb = ''.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
        INTO TABLE i_likp
        FROM vbup AS a INNER JOIN likp AS b
        ON avbeln = bvbeln
        WHERE
              b~kunnr IN s_kunnr
              AND b~vbeln IN s_vbeln
              AND b~wadat IN s_wadat
               AND a~kosta = 'C'.
      ELSEIF cb_kosta = 'X' AND cb_kostb = ' ' AND cb_kostc = ''.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
           INTO TABLE i_likp
           FROM vbup AS a INNER JOIN likp AS b
           ON avbeln = bvbeln
           WHERE
                 b~kunnr IN s_kunnr
                 AND b~vbeln IN s_vbeln
                 AND b~wadat IN s_wadat
                  AND a~kosta = 'A'.
      ELSEIF cb_kostb = 'X' AND cb_kosta = '' AND cb_kostc = ''.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
           INTO TABLE i_likp
           FROM vbup AS a INNER JOIN likp AS b
           ON avbeln = bvbeln
           WHERE
                 b~kunnr IN s_kunnr
                 AND b~vbeln IN s_vbeln
                 AND b~wadat IN s_wadat
                  AND kosta = 'B'.
      ELSEIF cb_kostc = 'X' AND cb_kosta = 'X' AND cb_kostb = 'X'.
        SELECT avbeln akosta bkunnr bwadat bernam bvkorg blfart bntgew
        INTO TABLE i_likp
        FROM vbup AS a INNER JOIN likp AS b
        ON avbeln = bvbeln
        WHERE
              b~kunnr IN s_kunnr
              AND b~vbeln IN s_vbeln
              AND b~wadat IN s_wadat
              AND kosta NE ' '.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM i_likp.
    ENDFORM.                    " GET_DATA
    *&      Form  GET_FIELD
          This form for defining the every fields from likp & lips tables
    FORM get_field .
    *This fields are retrieving from header table(likp)
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'VBELN'.
      i_fieldcat-seltext_m = 'SALES ORDER NO'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'KUNNR'.
      i_fieldcat-seltext_m = 'CUSTOMER NO'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'WADAT'.
      i_fieldcat-seltext_m = 'DATE'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'ERNAM'.
      i_fieldcat-seltext_m = 'NAME OF PERSON'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'VKORG'.
      i_fieldcat-seltext_m = 'SALES ORGANIZATION'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'LFART'.
      i_fieldcat-seltext_m = 'DELIVERY TYPE'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
      i_fieldcat-fieldname = 'NTGEW'.
      i_fieldcat-seltext_m = 'NET WEIGHT'.
      i_fieldcat-do_sum = 'X'.
      APPEND i_fieldcat TO i_fieldcat.
      CLEAR i_fieldcat.
    *This fields are retrieving from item table(lips)
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'VBELN'.
      i_fieldcat1-seltext_m = 'DELIVAR NO'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'POSNR'.
      i_fieldcat1-seltext_m = 'DELIVERY ITEM'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'MATNR'.
      i_fieldcat1-seltext_m = 'MATERIAL NO'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'LFIMG'.
      i_fieldcat1-seltext_m = 'ACTUAL QUANTITY'.
      i_fieldcat1-do_sum    = 'X'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'NTGEW'.
      i_fieldcat1-seltext_m = 'NET WEIGHT'.
      i_fieldcat1-do_sum = 'X'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'EXBWR'.
      i_fieldcat1-seltext_m = 'AMOUNT'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'ARKTX'.
      i_fieldcat1-seltext_m = 'SHORT TEXT FOR so ITEM'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
      i_fieldcat1-fieldname = 'DESCRIPTION'.
      i_fieldcat1-seltext_m = 'PICKING STATUS'.
      APPEND i_fieldcat1 TO i_fieldcat1.
      CLEAR i_fieldcat1.
    ENDFORM.                    " GET_FIELD
    *&      Form  GET_EVENTS
          This form defining the events
    *FORM GET_EVENTS .
    CLEAR W_EVENTS.
    W_EVENTS-NAME = 'USER_COMMAND'.
    W_EVENTS-FORM = 'RUCOMM'.
    APPEND W_EVENTS TO I_EVENTS.
    *ENDFORM.                    " GET_EVENTS
    *&      Form  DISPLAY
         This form is going to display header details from likp table
    FORM display .
    *This function module for displaying the header details
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = repid
          i_callback_top_of_page  = 'TOP-OF-PAGE'
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = i_fieldcat[]
          i_save                  = 'X'
          it_events               = i_events
        TABLES
          t_outtab                = i_likp
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY
    *&      Form  TOP-OF-PAGE
        This form is going to display top-of-page header text
    FORM top-of-page.
      DATA:  i_list_comments TYPE slis_t_listheader.
      DATA:  w_list_comments TYPE slis_listheader.
      CLEAR: i_list_comments[].
      w_list_comments-typ  = 'H'. "H=Header, S=Selection, A=Action
      w_list_comments-info = 'DELIVERY ORDER DETAILS'.
      APPEND w_list_comments TO i_list_comments.
      w_list_comments-typ  = 'A'. " H = Header, S = Selection, A = Action
      w_list_comments-info = 'Basic list'.
      APPEND w_list_comments TO i_list_comments.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'enjoy'
          it_list_commentary = i_list_comments.
    ENDFORM.                    "TOP-OF-PAGE
    *&      Form  TOP_OF_PAGE
           This form is going to display top-of-page item text
    FORM top_of_page.
      DATA:  i_list_comments TYPE slis_t_listheader.
      DATA:  w_list_comments TYPE slis_listheader.
      DATA : i_line LIKE w_list_comments-info.
      CONCATENATE 'DELIVERY ITEM DETAILS :' delivar1 INTO i_line .
    SEPARATED BY SPACE.
      CLEAR: i_list_comments[].
      w_list_comments-typ  = 'H'. "H=Header, S=Selection, A=Action
      w_list_comments-info = i_line.
      APPEND w_list_comments TO i_list_comments.
      w_list_comments-typ  = 'A'. " H = Header, S = Selection, A = Action
      w_list_comments-info = 'Secondary list'.
      APPEND w_list_comments TO i_list_comments.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'enjoy'
          it_list_commentary = i_list_comments.
    ENDFORM.                    "TOP_OF_PAGE

  • Problem with printing the sub totals

    Hi,
    I am having a problem with smart forms in printing the line items of invoice.
    I need to print the sub total of each page and need to display the sub total in the footer, with the caption 'Balance C f/w'. It works fine in some cases.
    In some cases, the sub total is getting printed wrongly, because its adding the amount of the next page's first line item also. I checked the form page by printing SFSY-PAGE along with the line item's text. It's observed that, the vlaue of SFSY-PAGE for the first line item's  displayed in the second page is '1'. Due to this, the amount for this line item also is getting calculated with the sub total of the previous page.
    Could you please suggest a solution for this problem?
    Thanks & Regards,
    John

    Hi,
    In smartforms, in the general attributes of the FIRST page the Mode for the page counter should be 'Initialize counter' and for the NEXT page it should be 'Increase counter'.
    Please check this in your smartform.
    Regards,
    Ram

  • HOW TO GET THE GRAND TOTALS IN  ALV USING GRID FM

    Hi,
    I would like to know that am getting the sub totals using the ALV_GRID FM,
    But I need Grand totals how i can get and what is the paramater to keep = x to get this Grand totals\.

    Hi,
    If you have the DO_SUM = 'X' in the field catalog internal table for the corresponding column..Then you will get the grand total..
    Thanks,
    Naren

  • Unable to calculate the Sub totals

    Hi,
    Currently we are in BI7. I had created a query based on aging buckets. it has all the calculations in the columns section. I have to calculate the sub totoals based on a particular info object Customer. For that I made the Result rows of the reamining info objects in the query to Always supress and for the info object Customer (based on which I have to show subtotals) I made it as Always Display.
    When I execute the query, I get 0 in the subtotals. Can any one let me know how do I get the sub totals correctly instead of 0's.
    Thanks in Advance

    Hi Kartikey,
    Thanks for the  response. I am not calculating the subtotals at the in the query definition and the sub totals are based on the info object 0customer's setting in the query designer to suppress the result rows. In RSRT also I am unable to get the sub totals.
    If I remove the calculations (aging buckets) and display direct key figure in the columns, I am able to get the sub totals.
    Is there any specific reason why the sub totals can not be calculated if the columns are calculated key figures/new formula.
    Can any one let me know how to fix the sub totals.
    Thanks

  • Am getting SUB TOTALS. But, I do NOT wanna show up the GRAND TOTALS in ALV

    Hi Experts,
    Am getting Sub Totals(line in dim yellow color) for my_alv report.........fine.
    But, for some reason, I do NOT wanna to show up the GRAND TOTALS(line in dark yellow color) for my_alv!!
    So, pls. let me know, How to get it done?
    thanq

    hi Srinivas,
    is_layout-no_totalline = 'X'.
    hope this helps
    ec

  • How to get sub totals in alv list

    Hi all,
    i have a data in internal table which need to display by alv lis display, but i need to display
    sub totals, like sub total by customer, subtotal by state, and complete total amount. In alv we have standard function
    buttons , by i need by default it is displayed when i exe my report, hope to achieve that.
    Please help me to know.
    thanks,
    rajesh

    hi Rajesh,
      Check these threads out
    http://www.sap-basis-abap.com/sapalv.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
    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
    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'.
    <b>GS_SORT-SUBTOT    = 'X'.</b>
    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.
    Regards,
    Santosh

  • Totals and Sub-Totals in ALV GRID

    Could anyone advice, how to display sub-totals and totals in ALV Grid(using FM).
    Ex:           value1    value2
                      100        50
                      200        50
        subtotal   300      100
        total                    400
    Thanks in advance...

    Refer below demo code and see perform Sort_list..
    it wil serve ur purpose.
    REPORT  ZGILL_ALV    message-id rp                           .
    type-pools slis.
    tables: zgill_main,zgill_details.
    data z_fieldcat type slis_t_fieldcat_alv.
    data begin of itab occurs 0.
    DATA ICON TYPE ICON-ID.
         include structure zgill_main.
    data salary like zgill_details-salary.
    data end of itab.
    *data itab1 like table of itab with header line.
    data : WA_SORT TYPE SLIS_SORTINFO_ALV,
           IT_SORT TYPE SLIS_T_SORTINFO_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
           IT_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
           WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    PARAMETERS: p_list  radiobutton group A1,
                P_GRID  RADIOBUTTON GROUP A1.
    SELECT-OPTIONS: S_PERNR FOR ZGILL_MAIN-PERNR.
    start-of-selection.
    perform fill_itab.
    perform sort_list.
    **************Start of scenario without container******************************************
    *********Method 1***********
    perform fill_fieldcat.  " Manuallly Preparing Fiedl Catalog
    *********Method 2***********
    *perform fill_fieldcat1 changing z_fieldcat.   "Preparing field catalog with merge function
    perform display_alv.
    *****************end of scenario without container*****************************************
    *&      Form  fill_itab
          text
    -->  p1        text
    <--  p2        text
    form fill_itab .
    *select * from zgill_main up to 20 rows INTO CORRESPONDING FIELDS OF TABLE itab.
    *ITAB1[] = ITAB[].
    select apernr aname aorg adob b~salary INTO CORRESPONDING FIELDS OF TABLE itab
           from zgill_main as a join zgill_details as b on apernr = bpernr
           WHERE A~PERNR IN S_PERNR.
    LOOP AT ITAB.
    IF ITAB-PERNR < 1111.
    ITAB-ICON = '@08@'.
    ELSEIF ITAB-PERNR > 1111 AND ITAB-PERNR < 11111111.
    ITAB-ICON = '@09@'.
    ELSEIF ITAB-PERNR GE 11111111.
    ITAB-ICON = '@0A@'.
    ENDIF.
    MODIFY ITAB INDEX SY-TABIX.
    ENDLOOP.
    endform.                    " fill_itab
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    form display_alv .
    data repid like sy-repid.
    REPID = SY-REPID.
    WA_LAYOUT-ZEBRA = 'X'.
    WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.
    WA_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
    WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.
    IF P_GRID = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = repid
       IT_FIELDCAT                       = IT_FIELDTAB
       IT_SORT                           = IT_SORT
       IS_LAYOUT                         = WA_LAYOUT
    TABLES
        t_outtab                          = itab[]
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2.
    IF sy-subrc <> 0.
       message e016 with 'Error in Display'.
    ENDIF.
    ELSEIF P_LIST = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = repid
       IT_FIELDCAT                       = IT_FIELDTAB
       IT_SORT                           = IT_SORT
       IS_LAYOUT                         = WA_LAYOUT
    TABLES
        t_outtab                          = itab[]
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2.
    IF sy-subrc <> 0.
       message e016 with 'Error in Display'.
    ENDIF.
    ENDIF.
    endform.                    " display_alv
    *&      Form  fill_fieldcat1
          text
    -->  p1        text
    <--  p2        text
    form fill_fieldcat1  changing d_fcat type slis_t_fieldcat_alv.
    data repid like sy-repid.
    data d_fcat1 type slis_t_fieldcat_alv with header line.
    REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_STRUCTURE_NAME             = 'ZGILL_MAIN'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_INCLNAME                   =
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
    CHANGING
        ct_fieldcat                  = d_fcat[]
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3.
    IF sy-subrc <> 0.
       message e016 with 'Error in preparing fiedl catalog'.
    ENDIF.
    loop at d_fcat into d_fcat1.
    case d_fcat1-fieldname.
    when 'NAME'.
    d_fcat1-reptext_ddic = 'Emp Name'.
    MODIFY D_FCAT FROM D_FCAT1.
    WHEN 'PERNR'.
    d_fcat1-reptext_ddic = 'Emp Num'.
    MODIFY D_FCAT FROM D_FCAT1.
    WHEN 'ORG'.
    d_fcat1-reptext_ddic = 'Org Unit'.
    MODIFY D_FCAT FROM D_FCAT1.
    endcase.
    clear d_fcat1.
    endloop.
    endform.                    " fill_fieldcat1
    *&      Form  sort_list
          text
    -->  p1        text
    <--  p2        text
    form sort_list .
    CLEAR WA_SORT.
    WA_SORT-FIELDNAME = 'DOB'.
    WA_SORT-SPOS = '1'.
    WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    WA_SORT-FIELDNAME = 'NAME'.
    WA_SORT-SPOS = '1'.
    WA_SORT-UP = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    endform.                    " sort_list
    *&      Form  fill_fieldcat
          text
    -->  p1        text
    <--  p2        text
    form fill_fieldcat .
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'ICON'.
    WA_FIELDCAT-SELTEXT_L = 'TRAFFIC'.
    WA_FIELDCAT-ICON = 'X'.
    WA_FIELDCAT-ddictxt = 'l'.
    WA_FIELDCAT-COL_POS = 1.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'PERNR'.
    WA_FIELDCAT-SELTEXT_L = 'EMP NUMBER'.
    WA_FIELDCAT-ddictxt = 'l'.
    WA_FIELDCAT-COL_POS = 2.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    when 'maktx'.
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'NAME'.
    WA_FIELDCAT-SELTEXT_L = 'EMP NAME'.
    WA_FIELDCAT-ddictxt = 'l'.
    WA_FIELDCAT-COL_POS = 3.
    WA_FIELDCAT-OUTPUTLEN = 15.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'ORG'.
    WA_FIELDCAT-SELTEXT_L = 'ORG UNIT'.
    WA_FIELDCAT-COL_POS = 4.
    WA_FIELDCAT-OUTPUTLEN = 10.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'DOB'.
    WA_FIELDCAT-SELTEXT_L = 'BIRTH DATE'.
    WA_FIELDCAT-COL_POS = 5.
    WA_FIELDCAT-OUTPUTLEN = 12.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    CLEAR WA_FIELDCAT .
    WA_FIELDCAT-TABNAME = 'ITAB'.
    WA_FIELDCAT-FIELDNAME = 'SALARY'.
    WA_FIELDCAT-SELTEXT_L = 'SALARY'.
    WA_FIELDCAT-COL_POS = 6.
    WA_FIELDCAT-OUTPUTLEN = 25.
    WA_FIELDCAT-do_sum = 'X'.
    APPEND WA_FIELDCAT TO IT_FIELDTAB.
    endform.                    " fill_fieldcat

  • Sub total in ALV GRID using oops concept

    Hi,
    If Plant (VBAP-WERKS) is not the same for all items on a Sales Order (VBAK-VBELN is the same for al items) then create a separate line on the report for each different plant specified in the line items.  Copy all fields from the original order line except for plant and Net Value.  Net Value should be the total of item Net Values for all items with the same plant in the order.
    Example:
    Data:
    Order----                     Item-             Plant-                                     Net Value---
    123----          010-               3467-                      100.00---
    123----          020-               7865-                      50.00---
    123----          030-               3467-                     80.50---
    Report:
    Order-                     Plant-                  Net Value---
    123-          3467-                  180.50---
    123-          7865-                   50.00----
    I need to dispaly the Report format in ALV Grid using oops concept...
    no need of calling any function modules.
    Regards,
    Nithya

    Hi
    Here is example code
    This is the method to be called:
    get_subtotals
    Use
    Returns the current subtotals of the ALV Grid Control. Having created totals for at least one column, users can calculate at most nine subtotals. The list is sorted by the values of one or several columns (called the subtotals column). If a value is changed in the subtotals column, the subtotal is displayed (this is also referred to as control level change).
    Integration
    Before you access the subtotals value, you use the method get_sort_criteria to get the sort table . One row of this table describes properties of a column in the output table.
    • If the field SUBTOT is set for a column in this table, the column is a subtotals column.
    • The field SPOS then indicates at which level (see below) the subtotal has been calculated.
    • The field FIELDNAME contains the name of the subtotals column in the output table.
    Based on this information, you specifically access the values of the tables passed (using reference variables COLLECT01 to COLLECT09).
    Features
    CALL METHOD <ref. var. to CL_GUI_ALV_GRID>->get_subtotals
    IMPORTING
    EP_COLLECT00 = <reference variable of type REF TO DATA>
    EP_COLLECT01 = <reference variable of type REF TO DATA>
    EP_COLLECT02 = <reference variable of type REF TO DATA>
    EP_COLLECT03 = <reference variable of type REF TO DATA>
    EP_COLLECT04 = <reference variable of type REF TO DATA>
    EP_COLLECT05 = <reference variable of type REF TO DATA>
    EP_COLLECT06 = <reference variable of type REF TO DATA>
    EP_COLLECT07 = <reference variable of type REF TO DATA>
    EP_COLLECT08 = <reference variable of type REF TO DATA>
    EP_COLLECT09 = <reference variable of type REF TO DATA>
    ET_GROUPLEVELS = <ínternal table of type LVC_T_GRPL>.
    In order to access the values of EP_COLLECT00 to EP_COLLECT09, you use ASSIGN to dereference the relevant reference variable in a field symbol of your output table type (see below).
    Parameters
    Meaning
    EP_COLLECT00
    Points to the totals line. Since there is only one totals line which, in addition, has a unique totalling area, no further information is available for this table in table ET_GROUPLEVELS.
    get_subtotals
    EP_COLLECT01 to EP_COLLECT09
    Point to the subtotals line. For each subtotals level, there is one reference variable. Each of these variables points to an internal table that has the type of the output table. EP_COLLECT01 points to the subtotal at the hightest level, while EP_COLLECT02 points to the subtotal at the second highest level, and so on. The levels are derived from the sort priority (field SPOS in the sort table ). The column by which the data was sorted first, is the highest subtotals level.
    ET_GROUPLEVELS
    Manages all indexes for the individual control levels. The fields of the table have the following meaning:
    • INDEX_FROM, INDEX_TO: Rows of the output table for which the subtotal was created
    • LEVEL: Subtotals level (see above)
    • COUNTER: Number of rows for which the subtotal was created
    • COMPRESS: For this subtotals line, the user has hidden the associated rows.
    • COLLECT: Indicates the subtotals table (01-09) in which the values are stored
    For an overview, see Methods of Class CL_GUI_ALV_GRID
    Activities

  • How to sub-total in alv?

    Hi,
    I have an alv layout like following:
    ZZZ 300100089 1050
    ZZZ 300100089 1050
    subtoal             2100
    90256243 300100000 193410
    90256242 300100000 173250
    90256241 300100000 173250
    90256240 300100000 173250
    90256239 300100000 173250
    90256238 300100000 173250
    90256237 300100000 173250
    subtotal           1232910
    when the second numbers are the same,
    I need to sum up as
    300100089      2100
    300100000     1232910
    I write the coding as the following, but it did not work, Please
    help and correct it!!
    the coding:
    data: it_sortcat type slis_sortinfo_alv occurs 1,
    wa_sort like line of it_sortcat.
    sort gt_outalv.
    wa_sort-fieldname = 'wrbtr'.
    wa_sort-SUBTOT = 'X'.
    APPEND wa_sort TO it_sortcat.
    In FM
    it_sort = it_sortcat
    I got dump and it did not work .
    Please correct my coding !!
    Thank you in advance,

    Check the Below Example program
    the code below produces alv display with 2 columns: field1 & field2.
    field1 is character based & the int. table passed to the alv is sorted on this field.
    field2 is numeric, whose subtotals are desired.
    so while populating the gt_sort table the option gs_sort-subtot is set for field1 bcoz the subtotals are to be based on the groups existing in this column.whereas the same option is NOT set for field2, even though the subtotal appears in that column.i have marked these 2 statements in the code for your convenience.
    execute the code below & you will surely understand what i said above.
    bye!!
    report zalv10.
    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'. ***CRUCIAL STATEMENT******
    *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'. **THIS SHOULD NOT BE UNCOMENTED**
    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.
    Kanagaraja L

Maybe you are looking for

  • Impostos não cálculados na ordem de vendas

    Olá, estou com um problema no atual cliente. Resulta que fiquei a cargo de aplicar a Localização Brasil e alguns problemas surgiram. Primeiro: O Client que estão usando (500) não foi copiado do 000 como a SAP recomenda. Segundo: Não rodaram a Country

  • Customer master deleted after billing how to give the credit memo

    this is my client senario customer master deleted  or changed after raised the billing hoe to give credit memo

  • Reg: Alv and selection-screen

    Hi, I created a ALV report, I gave the user provision delete rows and dispalyed the new list without the deleted rows( one row at a time) when i deleted few rows and when i press the back button i am getting all the rows deleted, but i want to jump d

  • Automatically exit window when a line in result view is selected

    Dear Experts, I am stuck with a small problem. I have create a custom component with search view and result view. Now in Component BT111h_oppt, when i have an item list assignment block. When i search for a product using F4, i have a standard search

  • Cannot import all photos onto PC

    When I connect my phone to my laptop it is not showing all the photos on my phone to allow me to import them all. I have approx. 2000 photos on my phone, but when I connect and browse my phone on my PC I can only see approximately 50 photos. I can se