Top Of Page not triggering in ALV

Hi
I am using ALV List Disaply. I have a itab that has 2000 Rows. When i scoll down, the header appears at the top always. Now i added the following code to trigger a Top of Page Event.
FORM xevents.
  CLEAR xs_event.
  xs_event-name = slis_ev_top_of_page.
  xs_event-form = 'XTOP_OF_PAGE'.
  APPEND xs_event TO gt_xevents.
  CLEAR xs_event.
ENDFORM.
FORM xtop_of_page.
BREAK-POINT.
  WRITE: / 'X_TOP_OF_PAGE'.
ENDFORM.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
    I_INTERFACE_CHECK              = ' '
    I_BYPASSING_BUFFER             =
    I_BUFFER_ACTIVE                = ' '
     i_callback_program             = sy-repid
    I_CALLBACK_PF_STATUS_SET       = ' '
    I_CALLBACK_USER_COMMAND        = ' '
    I_STRUCTURE_NAME               =
     is_layout                      = st_layout
     it_fieldcat                    = fieldcat[]
    IT_EXCLUDING                   =
    IT_SPECIAL_GROUPS              =
    IT_SORT                        =
     it_filter                      = filttab[]
    IS_SEL_HIDE                    =
    I_DEFAULT                      = 'X'
    I_SAVE                         = ' '
    IS_VARIANT                     =
      it_events                      = gt_xevents
    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
  IMPORTING
    E_EXIT_CAUSED_BY_CALLER        =
    ES_EXIT_CAUSED_BY_USER         =
    TABLES
      t_outtab                       = alv_tab[]
  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.

this  may  be help u ....
t_gt_events type slis_t_event,
form display_alv.
  v_repid = sy-repid.
  sort vit_final by flag vbeln .
perform get_top_of_page using t_gt_events[].
      gs_keyinfo-header01 = 'DISPO'.
      gs_keyinfo-item01 = 'DISPO'.
  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
        I_INTERFACE_CHECK        = ' '
         i_callback_program        = v_repid
        I_CALLBACK_PF_STATUS_SET = ' '
        I_CALLBACK_USER_COMMAND  = ' '
        I_STRUCTURE_NAME         =
         is_layout                = vfl_layout
         it_fieldcat               = vit_fieldcat
        IT_EXCLUDING             =
          it_special_groups       =
         it_sort                  = vit_sort
        IT_FILTER                =
        IS_SEL_HIDE              =
        I_DEFAULT                = 'X'
        I_SAVE                   = ' '
        IS_VARIANT               = ' '
         IT_EVENTS                = t_gt_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
        I_BYPASSING_BUFFER       =
        I_BUFFER_ACTIVE          =
   IMPORTING
    tables
            t_outtab               = vit_final
    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_ALV
*&      Form  get_top_of_page
      text
-->  p1        text
<--  p2        text
form get_top_of_page using t_gt_events type slis_t_event.
data: ls_event type slis_alv_event.
  call function 'REUSE_ALV_EVENTS_GET'
       exporting
            i_list_type = 0
       importing
            et_events   = t_gt_events.
  read table t_gt_events with key name = slis_ev_top_of_page
                           into ls_event.
  move c_formtop  to ls_event-form.
  append ls_event to t_gt_events.
endform.                    " get_top_of_page

Similar Messages

  • End_of_page is not triggering in ALV

    hi mates
             the code below is not triggering end-of-page event, can anyone help me. reply asap
    TABLES:VBAP.
    TYPE-POOLS:SLIS.
    DATA: BEGIN OF VBAP_TYPE OCCURS 0,
          VBELN TYPE VBAP-VBELN,
          POSNR TYPE VBAP-POSNR,
          MATKL TYPE VBAP-MATKL,
          MATNR TYPE VBAP-MATNR,
          END OF VBAP_TYPE.
    DATA:GET_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
         WA_FIELDCAT  TYPE SLIS_FIELDCAT_ALV,
         HT_EVENT    TYPE SLIS_T_EVENT,
         WA_EVENT     TYPE SLIS_ALV_EVENT,
         HT_HEADER   TYPE SLIS_T_LISTHEADER,
         WA_HEADER   TYPE SLIS_LISTHEADER.
    START-OF-SELECTION.
      PERFORM GET_DATA.
      PERFORM GET_FIELDCATALOG.
      PERFORM FIELD_EVENT.
      PERFORM FIELD_DISPLAY.
    *&      Form  get_data
          text
    FORM GET_DATA.
      SELECT VBELN
             POSNR
             MATKL
             MATNR
           FROM VBAP
           INTO TABLE VBAP_TYPE.
    ENDFORM.                    "get_data
    *&      Form  get_fieldcatalog
          text
    FORM GET_FIELDCATALOG.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 1.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-SELTEXT_L = 'sales doc'.
      APPEND WA_FIELDCAT TO GET_FIELDCAT.
      CLEAR WA_FIELDCAT.
    clear wa_fieldcat.
    wa_fieldcat-col_pos = 1.
    wa_fieldcat-fieldname = 'VBELN'.
    wa_fieldcat-seltext_l = 'sales doc'.
    append wa_fieldcat to get_fieldcat.
    clear wa_fieldcat.
      WA_FIELDCAT-COL_POS = 2.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-SELTEXT_L = 'sales doc item'.
      APPEND WA_FIELDCAT TO GET_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 3.
      WA_FIELDCAT-FIELDNAME = 'MATKL'.
      WA_FIELDCAT-SELTEXT_L = 'Material Group'.
      APPEND WA_FIELDCAT TO GET_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 4.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_L = 'Material No'.
      APPEND WA_FIELDCAT TO GET_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "get_fieldcatalog
    *&      Form  field_display
          text
    FORM FIELD_DISPLAY.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
       I_INTERFACE_CHECK              = ' '
       I_BYPASSING_BUFFER             =
       I_BUFFER_ACTIVE                = ' '
          I_CALLBACK_PROGRAM             = SY-CPROG
       I_CALLBACK_PF_STATUS_SET       = ' '
       I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               =
       IS_LAYOUT                      =
          IT_FIELDCAT                    = GET_FIELDCAT[]
       IT_EXCLUDING                   =
       IT_SPECIAL_GROUPS              =
       IT_SORT                        =
       IT_FILTER                      =
       IS_SEL_HIDE                    =
       I_DEFAULT                      = 'X'
       I_SAVE                         = ' '
       IS_VARIANT                     =
          IT_EVENTS                      = HT_EVENT
       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
       IR_SALV_LIST_ADAPTER           =
       IT_EXCEPT_QINFO                =
       I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER        =
       ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = VBAP_TYPE
       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.                    "field_display
    *&      Form  field_event
          text
    FORM FIELD_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = HT_EVENT.
    WA_EVENT-NAME = SLIS_EV_TOP_OF_PAGE .
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    APPEND WA_EVENT TO HT_EVENT.
    CLEAR WA_EVENT.
      WA_EVENT-NAME = SLIS_EV_END_OF_PAGE .
      WA_EVENT-FORM = 'END_OF_PAGE'.
    APPEND WA_EVENT TO HT_EVENT.
    CLEAR WA_EVENT.
    READ TABLE ht_event INTO wa_event
                         WITH KEY name = slis_ev_top_of_page .
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
    IF sy-subrc = 0.
       wa_event-form = 'TOP-OF-PAGE'.
       wa_event-form = 'END_OF_PAGE'.
       MODIFY ht_event FROM wa_event INDEX sy-tabix.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    "field_event
    *&      Form  top_of_page
          text
    FORM TOP_OF_PAGE.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = ' this is the sales document data'.
      APPEND WA_HEADER TO HT_HEADER.
      CLEAR WA_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = HT_HEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    "top_of_page
    *&      Form  END_OF_Page
          text
    FORM END_OF_PAGE.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = ' this is the end of page'.
      APPEND WA_HEADER TO HT_HEADER.
      CLEAR WA_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = HT_HEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
         it_list_commentary       = ht_header
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    endform.

    Hi,
    Try this code for end_of_page is not triggering in ALV
    TYPE-POOLS : slis.
    TABLES : mara,
             makt,
             marc.
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,
            maktx LIKE makt-maktx,
            werks LIKE marc-werks,
           END OF itab.
    DATA : t_fcat TYPE slis_t_fieldcat_alv,
           t_eve TYPE slis_t_event,
           st_line TYPE slis_listheader,
           t_list_top_page TYPE slis_t_listheader,
           t_list_end_page TYPE slis_t_listheader.
    DATA : t_mat LIKE mara-matnr.
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : mat FOR mara-matnr.
    SELECTION-SCREEN : END OF BLOCK blk1.
    INITIALIZATION.
      PERFORM build_cat USING t_fcat.
      PERFORM build_eve.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM build_header USING t_list_top_page[].
      PERFORM build_footer USING t_list_end_page[].
      PERFORM dis_data.
    *&      Form  buils_cat
          text
         -->TEMP_FCAT  text
    FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
      DATA : wa_fcat TYPE slis_fieldcat_alv.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-seltext_m = 'Material'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MAKTX'.
      wa_fcat-seltext_m = 'Material Description'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'WERKS'.
      wa_fcat-seltext_m = 'Plant'.
    wa_fcat-row_pos = 2.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
    ENDFORM.                    "build_cat
    *&      Form  build_eve
          text
    FORM build_eve.
      DATA : wa_eve TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = t_eve
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
      READ TABLE t_eve INTO wa_eve WITH KEY name = 'END_OF_LIST'.
      IF sy-subrc = 0.
        wa_eve-form = 'END_OF_PAGE'.
        MODIFY t_eve FROM wa_eve INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    "build_eve
    *&      Form  get_data
          text
    FORM get_data.
      SELECT maramatnr maktmaktx marc~werks INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara INNER JOIN makt ON
      maramatnr = maktmatnr
      INNER JOIN marc ON
      maramatnr = marcmatnr
      WHERE mara~matnr IN mat.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = 'ZALV_PRDS'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         it_fieldcat                       = t_fcat
         i_save                            = 'A'
         it_events                         = t_eve
       TABLES
          t_outtab                          = itab
    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.                    "dis_data
    *&      Form  build_header
          text
         -->TEMP_LIST          text
         -->TTYPE              text
         -->SLIS_T_LISTHEADER  text
    FORM build_header USING temp_list TYPE slis_t_listheader.
      CLEAR st_line.
      st_line-typ = 'H'.
      st_line-info = 'Material Info'.
      APPEND st_line TO temp_list.
    ENDFORM.                    "build_header
    *&      Form  build_footer
          text
         -->TEMP_LIST  text
    FORM build_footer USING temp_list TYPE slis_t_listheader.
      CLEAR st_line.
      st_line-typ = 'H'.
      st_line-info = 'Dhwani Shah'.
      APPEND st_line TO temp_list.
    ENDFORM.                    "build_header
    *&      Form  top_Of_page
          text
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_list_top_page.
    ENDFORM.                    "top_Of_page
    *&      Form  end_of_page
          text
    FORM end_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_list_end_page.
    ENDFORM.                    "end_of_page
    Reward Points if usefull
    Regards
    Fareedas

  • End of Page event not triggering in ALV report

    Hello,
    I am developing an ALV report using REUSE_ALV_LIST_DISPLAY. Whatever I write in top_of_page, it will be displayed in the header portion of the output.
    But I want to display some footer text at the end of the page. The problem I am facing is, the WRITE statements within end_of_page are not displayed when the report is run.
    I have populated the i_events as follows :
    FORM f_events CHANGING p_i_events TYPE slis_t_event.
    CONSTANTS : l_c_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
                l_c_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.
    DATA : l_wa_event TYPE slis_alv_event.
    Returns table of possible events
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_i_events.
    To append internal table holding event names with event 'TOP OF PAGE'
      READ TABLE  p_i_events INTO l_wa_event
      WITH KEY name = slis_ev_top_of_page.
      IF sy-subrc = 0.
          MOVE   l_c_top_of_page TO l_wa_event-form.
          APPEND l_wa_event      TO p_i_events.
      ENDIF.
    To append internal table holding event names with event 'END OF PAGE'
      READ TABLE  p_i_events INTO l_wa_event
      WITH KEY name = slis_ev_end_of_page.
      IF sy-subrc = 0.
          MOVE   l_c_end_of_page TO l_wa_event-form.
          APPEND l_wa_event      TO p_i_events.
      ENDIF.
    ENDFORM.                               "f_events
    Regds
    Rajesh

    Hi have a look at the following code, and change ur code for end of page accordingly. this will resolve ur problem.
    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.
    *END OF ZALV PROGRAM
    Satish

  • ALV TOP-OF-PAGE not popping up

    Hi I am working on ALV and I am trying to use Top-of-page functionality but somehow it's not popping up when I am trying to execute my report and just empty space is showing at the top of report. Following is my code:
    perform data.
    perform build_field_catalog.
    perform top_of_page.
    perform display_alv.
    FORM TOP_OF_PAGE .
      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.
    Report Heading
      wa_header-typ  = 'H'.
      wa_header-info = 'TEST 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.
    Time
      wa_header-typ  = 'S'.
      wa_header-key = 'Time: '.
      CONCATENATE  sy-uzeit(2) ':'
                   sy-uzeit+2(2) ':'
                   sy-uzeit+4(2) INTO wa_header-info.   "System time
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_output 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.
    FORM DISPLAY_ALV_REPORT .
    call function 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = gd_repid
          i_callback_top_of_page = 'TOP-OF-PAGE'
          is_layout              = gd_layout
          it_fieldcat            = fieldcatalog[]
          i_save                 = 'A'
        TABLES
          t_outtab               = it_output
        EXCEPTIONS
          program_error          = 1
          others                 = 2.
      if sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    thanks,
    Rajeev
    ENDFORM.                    " TOP_OF_PAGE

    hi check this example..
    REPORT ZTUFI091 .
    *& Report ZDEMO_ALVGRID *
    *& Example of a simple ALV Grid Report *
    *& The basic requirement for this demo is to display a number of *
    *& fields from the EKKO table. *
    *REPORT zdemo_alvgrid .
    TABLES: ekko.
    type-pools: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    gd_tab_group type slis_t_sp_group_alv,
    gd_layout type slis_layout_alv,
    gd_repid like sy-repid,
    gt_events type slis_t_event,
    gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype = 'CURR'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    endform. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    form build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    form display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    it_events = gt_events
    is_print = gd_prntparams
    i_save = 'X'
    is_variant = z_template
    tables
    t_outtab = it_ekko
    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_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
    from ekpo
    into table it_ekko.
    endform. " DATA_RETRIEVAL
    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.
    FORM USER_COMMAND *
    --> R_UCOMM *
    --> RS_SELFIELD *
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    ENDCASE.
    ENDFORM.
    *& Form BUILD_EVENTS
    Build events table
    form build_events.
    data: ls_event type slis_alv_event.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = gt_events[].
    read table gt_events with key name = slis_ev_end_of_page
    into ls_event.
    if sy-subrc = 0.
    move 'END_OF_PAGE' to ls_event-form.
    append ls_event to gt_events.
    endif.
    read table gt_events with key name = slis_ev_end_of_list
    into ls_event.
    if sy-subrc = 0.
    move 'END_OF_LIST' to ls_event-form.
    append ls_event to gt_events.
    endif.
    endform. " BUILD_EVENTS
    *& Form BUILD_PRINT_PARAMS
    Setup print parameters
    form build_print_params.
    gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
    gd_prntparams-no_coverpage = 'X'.
    endform. " BUILD_PRINT_PARAMS
    *& Form END_OF_PAGE
    form END_OF_PAGE.
    data: listwidth type i,
    ld_pagepos(10) type c,
    ld_page(10) type c.
    write: sy-uline(50).
    skip.
    write:/40 'Page:', sy-pagno .
    endform.
    *& Form END_OF_LIST
    form END_OF_LIST.
    data: listwidth type i,
    ld_pagepos(10) type c,
    ld_page(10) type c.
    skip.
    write:/40 'Page:', sy-pagno .
    endform.
    regards,
    venkat

  • Events not triggering in alv list, point will be given

    Hi friends,
          I am using reuse_alv_list_display fm to display data.
    and i am using reuse_alv_events_get fm to trigger events.
    but, top_of_page, event is not triggering,
    more precisely , the subroutine is not getting recognized by system.  how to rectify this.
    Check my code.
    *& Report  ZSEN_SERVICETAX_GTA
    REPORT  zsen_servicetax_gta NO STANDARD PAGE HEADING LINE-COUNT 100.
    *****************************************TABLES USED**********************************************************************
    *TABLES: BSIS,  "Accounting: Secondary Index for G/L Accounts
           BSAS,  "Accounting: Secondary Index for G/L Accounts (Cleared Items)
           LFA1.  "Vendor Master (General Section).
    *****************************************WORK AREA / INTERNAL TABLE DECLARATION******************************************
    TYPE-POOLS: slis.
    TYPES: BEGIN OF ty_main,
           hkont    TYPE bsis-hkont,
           belnr    TYPE bsis-belnr,
           budat    TYPE bsis-budat,
           blart    TYPE bsis-blart,
           dmbtr    TYPE bsis-dmbtr,
           xblnr    TYPE bsis-xblnr,
           shkzg    TYPE bsis-shkzg,
           augbl TYPE bsis-augbl,
           kz_dmbtr TYPE bsis-dmbtr,
           kz_xblnr TYPE bsis-xblnr,
           kz_blart TYPE bsis-blart,
           kz_belnr TYPE bsis-belnr,
           kz_budat TYPE bsis-budat,
           kz_zuonr TYPE bsis-zuonr,
           name1    TYPE lfa1-name1,
           slno     TYPE i,
           END OF ty_main,
           BEGIN OF ty_bsas,
           belnr TYPE bsas-hkont,
           budat TYPE bsas-budat,
           xblnr TYPE bsas-xblnr,
           augbl TYPE bsas-augbl,
           dmbtr TYPE bsas-dmbtr,
           blart TYPE bsas-blart,
           zuonr TYPE bsas-zuonr,
           END OF ty_bsas.
    DATA: it_main TYPE TABLE OF ty_main,
          wa_main LIKE LINE OF it_main,
          it_bsas TYPE TABLE OF ty_bsas,
          wa_bsas LIKE LINE OF it_bsas.
    DATA: it_sort       TYPE slis_t_sortinfo_alv,
          fieldcatalog  TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_layout     TYPE slis_layout_alv,
          gt_events     TYPE slis_t_event,
          int_fcat      TYPE slis_fieldcat_alv,
          it_header     TYPE slis_t_listheader,
          wa_header     TYPE slis_listheader.
    ************************************************work variables***********************************************************************
    DATA: ven_name   TYPE lfa1-name1,
          post_date  TYPE bsis-budat,
          t_tabix    TYPE sy-tabix,
          i_prg      LIKE sy-repid.
    ***********************************************selection screen***********************************************************************
    SELECTION-SCREEN: BEGIN OF BLOCK gtn WITH FRAME TITLE text-001 .
    SELECT-OPTIONS: date FOR post_date OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK gtn.
    ************************************************data selection**************************************************************************
    START-OF-SELECTION.
      PERFORM data_retreval.
      PERFORM build_catalog.
      PERFORM layout.
      PERFORM build_events.
      PERFORM sortinfo.
      IF it_main[] IS NOT INITIAL.
        PERFORM display_alv.
      ELSE.
        MESSAGE 'No Records Matching For This Selection' TYPE 'E'.
      ENDIF.
    ******************************data display*********************************************************************************************
    *&      Form  data_retreval
          text
    -->  p1        text
    <--  p2        text
    FORM data_retreval .
      CLEAR:it_main[], wa_main, fieldcatalog[].
    ***********************************************selecting data from bsis table for the given date range**********************************
      SELECT ahkont abelnr abudat ablart admbtr axblnr a~shkzg
             b~augbl
             INTO CORRESPONDING FIELDS OF TABLE it_main
             FROM bsis AS a LEFT OUTER JOIN bsas AS b
             ON abelnr = bbelnr
             WHERE a~budat IN date
             AND   a~blart = 'KR'
             AND   a~shkzg = 'S'
             AND   a~hkont = '0002200530'.
    ***********************************************selecting data from bsas table using bsis-belnr*******************************************
      LOOP AT it_main INTO wa_main.
        SELECT belnr budat dmbtr xblnr zuonr  augbl blart
               INTO CORRESPONDING FIELDS OF wa_bsas
               FROM bsas
               WHERE belnr = wa_main-augbl
               AND   blart = 'KZ'.
        ENDSELECT.
        APPEND wa_bsas TO it_bsas.
      ENDLOOP.
    ********************************************combining two tables data******************************************************************
      LOOP AT it_main INTO wa_main.
        t_tabix = sy-tabix.
           wa_main-slno     = t_tabix.
        READ TABLE it_bsas INTO wa_bsas WITH KEY augbl = wa_main-augbl.
        IF sy-subrc = 0.
          SELECT SINGLE name1
                 FROM lfa1
                 INTO ven_name
                 WHERE lifnr = wa_bsas-zuonr.
          wa_main-kz_dmbtr = wa_bsas-dmbtr.
          wa_main-kz_belnr = wa_bsas-belnr.
          wa_main-kz_blart = wa_bsas-blart.
          wa_main-kz_budat = wa_bsas-budat.
          wa_main-kz_xblnr = wa_bsas-xblnr.
          wa_main-kz_zuonr = wa_bsas-zuonr.
          wa_main-name1    = ven_name.
        ENDIF.
        MODIFY it_main FROM wa_main INDEX t_tabix TRANSPORTING kz_dmbtr kz_belnr kz_budat kz_blart kz_xblnr kz_zuonr name1 .
      ENDLOOP.
      SORT it_main BY kz_blart kz_zuonr.
      LOOP AT it_main INTO wa_main.
        wa_main-slno = sy-tabix.
        MODIFY it_main FROM wa_main INDEX sy-tabix TRANSPORTING slno.
      ENDLOOP.
    ENDFORM.                    " data_retreval
    *&      Form  build_catalog
          text
    -->  p1        text
    <--  p2        text
    FORM build_catalog .
      DATA: col_pos TYPE i.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'SLNO'.
      fieldcatalog-seltext_m = 'Serial No'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'KZ_ZUONR'.
      fieldcatalog-seltext_m = 'Vendor Num'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'NAME1'.
      fieldcatalog-seltext_m = 'Vendor Name'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'BLART'.
      fieldcatalog-seltext_m = 'BillDoc.Type'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'BELNR'.
      fieldcatalog-seltext_m = 'BillDoc.Num.'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'BUDAT'.
      fieldcatalog-seltext_m = 'BillPosting Date'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'XBLNR'.
      fieldcatalog-seltext_m = 'BillReference Num'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'DMBTR'.
      fieldcatalog-seltext_m = 'Bill Amount'.
      fieldcatalog-col_pos   = col_pos.
      fieldcatalog-do_sum    = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'KZ_BLART'.
      fieldcatalog-seltext_m = 'Pay_Doc.type'.
      fieldcatalog-col_pos   = col_pos.
       fieldcatalog-do_sum    = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'KZ_BELNR'.
      fieldcatalog-seltext_m = 'Pay_Document No'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'KZ_DMBTR'.
      fieldcatalog-seltext_m = 'Payment Amount'.
      fieldcatalog-col_pos   = col_pos.
      fieldcatalog-do_sum    = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'KZ_XBLNR'.
      fieldcatalog-seltext_m = 'Pay_Reference Num'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'KZ_BUDAT'.
      fieldcatalog-seltext_m = 'Pay_Posting Date'.
      fieldcatalog-col_pos   = col_pos.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
      col_pos = col_pos + 1.
      fieldcatalog-fieldname = 'AUGBL'.
      fieldcatalog-seltext_m = 'Clr.Doc.Num'.
      fieldcatalog-col_pos   = col_pos.
       fieldcatalog-row_pos   = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR: fieldcatalog.
    ENDFORM.                    " build_catalog
    *&      Form  sortinfo
          text
    -->  p1        text
    <--  p2        text
    FORM sortinfo .
      DATA: is_sort TYPE slis_sortinfo_alv.
      CLEAR:is_sort.
      is_sort-spos       = 2.
      is_sort-fieldname  = 'KZ_ZUONR'.
      is_sort-up         = 'X'.
      APPEND is_sort TO it_sort.
      CLEAR: is_sort.
      is_sort-spos       = 1.
      is_sort-fieldname  = 'KZ_BLART'.
      is_sort-up         = 'X'.
      is_sort-subtot     = 'X'.
      APPEND is_sort TO it_sort.
    ENDFORM.                    " sortinfo
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    FORM layout .
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-zebra             = 'X'.
    *gd_layout-totals_text       = 'Grand Total'.
    *gd_layout-subtotals_text    = 'BillBooked Not Paid'.
    ENDFORM.                    " layout
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv .
      i_prg = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = 'I_PRG'
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = 'TOP-OF-PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = '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                       = fieldcatalog[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
         it_sort                           = it_sort
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
         it_events                         = gt_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
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_main
    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_alv
    *&      Form  build_events
          text
    -->  p1        text
    <--  p2        text
    FORM build_events .
      DATA: is_event TYPE slis_alv_event.
    break-point.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = gt_events[]
      EXCEPTIONS
        LIST_TYPE_WRONG       = 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.
      READ TABLE gt_events WITH KEY name = slis_ev_top_of_page INTO is_event.
      IF sy-subrc = 0.
        MOVE 'TOP_OF_PAGE' TO is_event-form.
       MODIFY gt_events from is_event TRANSPORTING form WHERE name = slis_ev_top_of_page.
      ENDIF.
    ENDFORM.                    " build_events
    *&      Form  top_of_page
          text
    -->  p1        text
    <--  p2        text
    form top_of_page .
        BREAK-POINT.
        SKIP 3.
        WRITE:/20 'BILLING DETAILS', 40 'PAYMENT DETAILS'.
    endform.                    " top_of_page
    Regards.
    s.senthil kumar

    hi i modified ur program , check this and let me know
    REPORT zsen_servicetax_gta NO STANDARD PAGE HEADING LINE-COUNT 100.
    *****************************************TABLES USED**********************************************************************
    TABLES: BSIS, "Accounting: Secondary Index for G/L Accounts
    BSAS, "Accounting: Secondary Index for G/L Accounts (Cleared Items)
    LFA1. "Vendor Master (General Section).
    *****************************************WORK AREA / INTERNAL TABLE DECLARATION******************************************
    TYPE-POOLS: slis.
    TYPES: BEGIN OF ty_main,
    hkont TYPE bsis-hkont,
    belnr TYPE bsis-belnr,
    budat TYPE bsis-budat,
    blart TYPE bsis-blart,
    dmbtr TYPE bsis-dmbtr,
    xblnr TYPE bsis-xblnr,
    shkzg TYPE bsis-shkzg,
    augbl TYPE bsis-augbl,
    kz_dmbtr TYPE bsis-dmbtr,
    kz_xblnr TYPE bsis-xblnr,
    kz_blart TYPE bsis-blart,
    kz_belnr TYPE bsis-belnr,
    kz_budat TYPE bsis-budat,
    kz_zuonr TYPE bsis-zuonr,
    name1 TYPE lfa1-name1,
    slno TYPE i,
    END OF ty_main,
    BEGIN OF ty_bsas,
    belnr TYPE bsas-hkont,
    budat TYPE bsas-budat,
    xblnr TYPE bsas-xblnr,
    augbl TYPE bsas-augbl,
    dmbtr TYPE bsas-dmbtr,
    blart TYPE bsas-blart,
    zuonr TYPE bsas-zuonr,
    END OF ty_bsas.
    DATA: it_main TYPE TABLE OF ty_main,
    wa_main LIKE LINE OF it_main,
    it_bsas TYPE TABLE OF ty_bsas,
    wa_bsas LIKE LINE OF it_bsas.
    DATA: it_sort TYPE slis_t_sortinfo_alv,
    IT_fieldcatalog TYPE slis_t_fieldcat_alv ,
    WA_fieldcatalog TYPE slis_fieldcat_alv,
    gd_layout TYPE slis_layout_alv,
    gt_events TYPE slis_t_event,
    WA_EVENTS TYPE SLIS_T_EVENT,
    int_fcat TYPE slis_fieldcat_alv,
    it_header TYPE slis_t_listheader,
    wa_header TYPE slis_listheader.
    ************************************************work variables***********************************************************************
    DATA: ven_name TYPE lfa1-name1,
    post_date TYPE bsis-budat,
    t_tabix TYPE sy-tabix,
    i_prg LIKE sy-repid.
    ***********************************************selection screen***********************************************************************
    SELECTION-SCREEN: BEGIN OF BLOCK gtn WITH FRAME TITLE text-001 .
    SELECT-OPTIONS: date FOR BSIS-BUDAT .
    SELECTION-SCREEN: END OF BLOCK gtn.
    ************************************************data selection**************************************************************************
    START-OF-SELECTION.
    PERFORM data_retreval.
    PERFORM build_catalog.
    PERFORM layout.
    PERFORM build_events.
    PERFORM sortinfo.
    IF it_main[] IS NOT INITIAL.
    PERFORM display_alv.
    ELSE.
    MESSAGE 'No Records Matching For This Selection' TYPE 'E'.
    ENDIF.
    ******************************data display*********************************************************************************************
    **& Form data_retreval
    *text
    *--> p1 text
    *<-- p2 text
    FORM data_retreval .
    CLEAR:it_main[], wa_main.
    ***********************************************selecting data from bsis table for the given date range**********************************
    SELECT ahkont abelnr abudat ablart admbtr axblnr a~shkzg
    b~augbl
    INTO CORRESPONDING FIELDS OF TABLE it_main
    FROM bsis AS a LEFT OUTER JOIN bsas AS b
    ON abelnr = bbelnr
    WHERE a~budat IN date.
    *AND a~blart = 'KR'
    *AND a~shkzg = 'S'
    *AND a~hkont = '0002200530'.
    ***********************************************selecting data from bsas table using bsis-belnr*******************************************
    LOOP AT it_main INTO wa_main.
    SELECT belnr budat dmbtr xblnr zuonr augbl blart
    INTO CORRESPONDING FIELDS OF wa_bsas
    FROM bsas
    WHERE belnr = wa_main-augbl
    AND blart = 'KZ'.
    ENDSELECT.
    APPEND wa_bsas TO it_bsas.
    ENDLOOP.
    ********************************************combining two tables data******************************************************************
    LOOP AT it_main INTO wa_main.
    t_tabix = sy-tabix.
    wa_main-slno = t_tabix.
    READ TABLE it_bsas INTO wa_bsas WITH KEY augbl = wa_main-augbl.
    IF sy-subrc = 0.
    SELECT SINGLE name1
    FROM lfa1
    INTO ven_name
    WHERE lifnr = wa_bsas-zuonr.
    wa_main-kz_dmbtr = wa_bsas-dmbtr.
    wa_main-kz_belnr = wa_bsas-belnr.
    wa_main-kz_blart = wa_bsas-blart.
    wa_main-kz_budat = wa_bsas-budat.
    wa_main-kz_xblnr = wa_bsas-xblnr.
    wa_main-kz_zuonr = wa_bsas-zuonr.
    wa_main-name1 = ven_name.
    ENDIF.
    MODIFY it_main FROM wa_main INDEX t_tabix TRANSPORTING kz_dmbtr kz_belnr kz_budat kz_blart kz_xblnr kz_zuonr name1 .
    ENDLOOP.
    SORT it_main BY kz_blart kz_zuonr.
    LOOP AT it_main INTO wa_main.
    wa_main-slno = sy-tabix.
    MODIFY it_main FROM wa_main INDEX sy-tabix TRANSPORTING slno.
    ENDLOOP.
    ENDFORM. " data_retreval
    **& Form build_catalog
    *text
    *--> p1 text
    *<-- p2 text
    FORM build_catalog .
    DATA: col_pos TYPE i.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'SLNO'.
    WA_fieldcatalog-seltext_m = 'Serial No'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'KZ_ZUONR'.
    WA_fieldcatalog-seltext_m = 'Vendor Num'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'NAME1'.
    WA_fieldcatalog-seltext_m = 'Vendor Name'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'BLART'.
    WA_fieldcatalog-seltext_m = 'BillDoc.Type'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'BELNR'.
    WA_fieldcatalog-seltext_m = 'BillDoc.Num.'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'BUDAT'.
    WA_fieldcatalog-seltext_m = 'BillPosting Date'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'XBLNR'.
    WA_fieldcatalog-seltext_m = 'BillReference Num'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'DMBTR'.
    WA_fieldcatalog-seltext_m = 'Bill Amount'.
    WA_fieldcatalog-col_pos = col_pos.
    WA_fieldcatalog-do_sum = 'X'.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'KZ_BLART'.
    WA_fieldcatalog-seltext_m = 'Pay_Doc.type'.
    WA_fieldcatalog-col_pos = col_pos.
    WA_fieldcatalog-do_sum = 'X'.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'KZ_BELNR'.
    WA_fieldcatalog-seltext_m = 'Pay_Document No'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'KZ_DMBTR'.
    WA_fieldcatalog-seltext_m = 'Payment Amount'.
    WA_fieldcatalog-col_pos = col_pos.
    WA_fieldcatalog-do_sum = 'X'.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'KZ_XBLNR'.
    WA_fieldcatalog-seltext_m = 'Pay_Reference Num'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'KZ_BUDAT'.
    WA_fieldcatalog-seltext_m = 'Pay_Posting Date'.
    WA_fieldcatalog-col_pos = col_pos.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    col_pos = col_pos + 1.
    WA_fieldcatalog-fieldname = 'AUGBL'.
    WA_fieldcatalog-seltext_m = 'Clr.Doc.Num'.
    WA_fieldcatalog-col_pos = col_pos.
    WA_fieldcatalog-row_pos = 2.
    APPEND WA_fieldcatalog TO IT_fieldcatalog.
    CLEAR: WA_fieldcatalog.
    ENDFORM. " build_catalog
    **& Form sortinfo
    *text
    *--> p1 text
    *<-- p2 text
    FORM sortinfo .
    DATA: is_sort TYPE slis_sortinfo_alv.
    CLEAR:is_sort.
    is_sort-spos = 2.
    is_sort-fieldname = 'KZ_ZUONR'.
    is_sort-up = 'X'.
    APPEND is_sort TO it_sort.
    CLEAR: is_sort.
    is_sort-spos = 1.
    is_sort-fieldname = 'KZ_BLART'.
    is_sort-up = 'X'.
    is_sort-subtot = 'X'.
    APPEND is_sort TO it_sort.
    ENDFORM. " sortinfo
    **& Form layout
    *text
    *--> p1 text
    *<-- p2 text
    FORM layout .
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-zebra = 'X'.
    *gd_layout-totals_text = 'Grand Total'.
    *gd_layout-subtotals_text = 'BillBooked Not Paid'.
    ENDFORM. " layout
    **& Form display_alv
    *text
    *--> p1 text
    *<-- p2 text
    FORM display_alv .
    i_prg = sy-repid.
    DATA:it_events TYPE slis_t_event,
           wa_events TYPE slis_alv_event.
    WA_events-name = 'TOP_OF_PAGE'.
      WA_events-form = 'TOP_OF_PAGE'.
      APPEND  wa_events TO it_events.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    *I_INTERFACE_CHECK = ' '
    *I_BYPASSING_BUFFER = ' '
    *I_BUFFER_ACTIVE = ' '
    i_callback_program = 'I_PRG'
    *I_CALLBACK_PF_STATUS_SET = ' '
    *I_CALLBACK_USER_COMMAND = ' '
    I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
    *I_CALLBACK_HTML_TOP_OF_PAGE = '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 = IT_fieldcatalog[]
    *IT_EXCLUDING =
    *IT_SPECIAL_GROUPS =
    *it_sort = it_sort
    *IT_FILTER =
    *IS_SEL_HIDE =
    *I_DEFAULT = 'X'
    *I_SAVE = ' '
    *IS_VARIANT =
    it_events = 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
    *I_HTML_HEIGHT_TOP = 0
    *I_HTML_HEIGHT_END = 0
    *IT_ALV_GRAPHICS =
    *IT_HYPERLINK =
    *IT_ADD_FIELDCAT =
    *IT_EXCEPT_QINFO =
    *IR_SALV_FULLSCREEN_ADAPTER =
    *IMPORTING
    *E_EXIT_CAUSED_BY_CALLER =
    *ES_EXIT_CAUSED_BY_USER =
    *TABLES
    *t_outtab = it_main
    *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_alv
    **& Form build_events
    *text
    *--> p1 text
    *<-- p2 text
    FORM build_events .
    DATA: is_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = gt_events[]
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2
    IF sy-subrc NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE gt_events WITH KEY name = slis_ev_top_of_page INTO is_event.
    IF sy-subrc = 0.
    MOVE 'TOP_OF_PAGE' TO is_event-form.
    MODIFY gt_events from is_event TRANSPORTING form WHERE name = slis_ev_top_of_page.
    ENDIF.
    ENDFORM. " build_events
    **& Form top_of_page
    *text
    *--> p1 text
    *<-- p2 text
    form top_of_page .
    SKIP 3.
    WRITE:/20 'BILLING DETAILS', 40 'PAYMENT DETAILS'.
    ENDFORM.
    reward points if useful,
    venkat.

  • Second page not triggering in SAP script

    plz help me in this too
    The code below is for two pages.
    Problem is that...My second page is not triggering.
    In the layout
    for Fist page
    attributes.
    page: FIRST
    next page: SECOND
    for second page
    attributes.
    page:SECOND
    next page: SECOND
    REPORT ZNEW1 .
    TABLES: MARA.
    DATA: BEGIN OF ITAB OCCURS 0,
    MATNR LIKE MARA-MATNR,
    ERSDA LIKE MARA-ERSDA,
    ERNAM LIKE MARA-ERNAM,
    LAEDA LIKE MARA-LAEDA,
    END OF ITAB.
    SELECT * FROM MARA INTO CORRESPONDING FIELDS OF table ITAB
    WHERE VPSTA = 'K'.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    *DEVICE = ' '
    DIALOG = 'X'
    FORM = 'ZNEWLAY1'
    LANGUAGE = SY-LANGU
    EXCEPTIONS
    OTHERS = 1.
    call function 'START_FORM'
    EXPORTING
    FORM = 'ZNEWLAY1'
    LANGUAGE = ' '
    STARTPAGE = 'FIRST'
    PROGRAM = ' '
    MAIL_APPL_OBJECT =
    IMPORTING
    LANGUAGE =
    EXCEPTIONS
    UNOPENED = 1
    OTHERS = 2.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'HEADER'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'HEADER'
    EXCEPTIONS
    UNOPENED = 1
    OTHERS = 2.
    call function 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'LOGO'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'LOGO'
    EXCEPTIONS
    UNOPENED = 4
    OTHERS = 9.
    LOOP AT ITAB.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'MAIN'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    UNOPENED = 1
    OTHERS = 2
    ENDLOOP.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'FOOTER'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'FOOTER'
    EXCEPTIONS
    UNOPENED = 1
    OTHERS = 2.
    call function 'END_FORM'
    EXCEPTIONS
    UNOPENED = 1
    BAD_PAGEFORMAT_FOR_PRINT = 2
    OTHERS = 3.
    call function 'START_FORM'
    EXPORTING
    ARCHIVE_INDEX =
    FORM = 'ZNEWLAY1'
    LANGUAGE = ' '
    STARTPAGE = 'SECOND'
    PROGRAM = ' '
    MAIL_APPL_OBJECT =
    EXCEPTIONS
    UNOPENED = 1
    OTHERS = 2.
    call function 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'MAIN'
    FUNCTION = 'SET'
    TYPE = 'BODY'
    WINDOW = 'MAIN'
    EXCEPTIONS
    UNOPENED = 1
    OTHERS = 2.
    call function 'END_FORM'
    EXCEPTIONS
    UNOPENED = 1
    BAD_PAGEFORMAT_FOR_PRINT = 2
    OTHERS = 3.
    CALL FUNCTION 'CLOSE_FORM'
    EXCEPTIONS
    UNOPENED = 1
    OTHERS = 2.

    Hi Scientila Choudary,
           Your problem will be cleared once you remove start_form and end_form as these are not necessary.we have to use start_from and end_from when we are operating on different forms.Presently we are operating on only no need to use this.
           Once your problem is solved please close this.

  • Event not triggering in ALV

    Hi All,
    I am using ALV GRID in object oriented with editing option.If user made any changes in the Grid ,then i will captured the changes by the event DATA_CHANGED and i will display the error message inside the DATA_CHANGED event method using Method ADD_PROTOCOL_ENTRY and DISPLAY_PROTOCOL(which displayed a message in popup window with the field name ,row etc.).
    The Method CHECK_CHANGED_DATA in PAI will trigger DATA_CHANGE event.It is some time triggering DATA_CHANGED and some time it is not triggering DATA_CHANGED event..Why it is not triggering DATA_CHANGED event?
    Can any one give me solution for this.....
    Thanks in Advance..

    Hi,
    i have to register an ENTER  event:
    that is
    CALL METHOD alv->register_edit_event
    EXPORTING
    i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    For this also it is not triggering...

  • To display the typ, key field,info in the top-of -page event in OO ALV

    Hi all,
    I need to display the heading and the other select option details in the top-of-page  event in ooalv.How can the key ,typ and the info of top of event  in alv grid be passed in ooalv grid display.
    Regards,
    Arpita

    Check the blog.
    TOP_OF_PAGE in ALV  Using CL_GUI_ALV_GRID
    Now you have to use the method ADD_TEXT to populate the Select options details.
    I hope you know the Function to get the selection details
    RS_REFRESH_FROM_SELECTOPTIONS,. it will give into a table. so use that table and populate the TOP_OF_PAGE uisng the class CL_DD_DOCUMENT.

  • Top of page in Block list ALV

    HI,
    I have a Requirement where i have a Block list ALV . I have 4 blocks to be Displayed in the output and the output has to be transfered to the PDF.
    I am able to get the 4 blocks in the output and the Top of Page for the Report in each page.
    But the Problem is when i download the output containing the top of page of output with 4 blocks into a PDF.
    I want the Top of page of Report to be the Top of Page of the PDf also.
    In PDF the Top of page of Report is coming in the center of the PDF also in some other places also.
    How to make sure the Top of page of Report comes in the top of the PDf
    Can you kinldy help me in this.
    Thanks,
    Gokul

    Duplicate post.
    Reported.

  • How to make New Events appear at TOP of page, not Bottom?

    When I import photos, they are automatically put into a new Event. That's great. But that Event appears way at the bottom of my long events list, even though my Events are shown chronologically with the most recent events right at the top. I have to drag the new event all the way through dozens of older events in order to bring it up to the top, where I can figure out which other event folders those new images might belong (ex: "family photos, Fall 2008").
    This isn't the biggest problem in the world, but I'd love to know how to set iPhoto to create the new event at the top of the list instead of the bottom. Any help? Thanks.

    Welcome to the Apple Discussions. In the View->Sort menu select Descending. However that will also have the photos in the Photos mode be sorted descending. In the Event mode you can sort the events in one direction and the photos in those events in the other. In the Photos mode both the Events and photos are sorted the same direction.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    Note: There's now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • Allignment in ALV top of page using oops

    I am displaying some fields with their values on top of page using Classes.but i am not able to get a proper alignment.
    i want the field and their respective values one-below the other with once the field description and the values below after the description. eg...
      field : 0125465
               0123654
               23654100
    sales : au01
               sd02
               GH26
    org    : 101
               102
               103

    Check this sample..
    Take the code from the HTML_TOP_OF_PAGE from the below report.
    REPORT  ztest_page.
    DATA : it_flight TYPE TABLE OF sflight WITH HEADER LINE.
    data: t type x.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO TABLE it_flight.
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = sy-repid
          i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          i_callback_top_of_page      = 'TOP_OF_PAGE'
          i_structure_name            = 'SFLIGHT'
        TABLES
          t_outtab                    = it_flight
        EXCEPTIONS
          program_error               = 1
          OTHERS                      = 2.
    *&      Form  TOP_OF_PAGE
    *       text
    FORM top_of_page.
      WRITE 'This is the Top of page which triggers in print'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  html_top_of_page
    FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
      DATA : dl_text(255) TYPE c.  "Text
    * Add new-line
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
      CLEAR : dl_text.
    * program ID
      dl_text = 'Program Name :'.
      CALL METHOD document->add_gap.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_heading_int.
      CLEAR dl_text.
      dl_text = sy-repid.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      CLEAR : dl_text.
      dl_text = sy-uname.
      CALL METHOD document->add_gap
        EXPORTING
          width = 34.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      CLEAR : dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 34.
    * Move date
      WRITE sy-datum TO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      CLEAR : dl_text.
    * Move time
      WRITE sy-uzeit TO dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 34.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
    ENDFORM.                    "HTML_TOP_OF_PAGE
    same Code can be used in the class. you take the above code and see..

  • Problem in ALV Top of Page

    Hi All,
    I am having a ALV report .Once i execute the report there will be ALV output once i click on the Material no((Hot spot)) in the output it ll take to the another ALV report.The problem is how to get the top of page in the second alv...The top of page in the second ALV should be different..
    Is it possible to do this?Pls reply asap.
    Thanks
    Raj.

    Hi Arun,
    It is not working in the way you have given.
    Hi All,
    Is there any way to do this ???
    Thanks
    Raj.

  • How to display horizontal line in top-of-page by using object oriented ALV?

    How to display horizontal line in top-of-page by using object oriented ALV.
    I am created top-of-page in object oriented alv.
    But not be successes in showing horizontal line in it.
    Can any one pls give solution for this..
    Thanks and regards..

    Hi
    Try like this
    data: gt_list_top_of_page type slis_t_listheader. " Top of page text. 
    Initialization. 
    perform comment_build using gt_list_top_of_page[]. 
    form top_of_page. 
    * Note to self: the gif must be loaded into transaction OAOR with 
    * classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions. 
    * I Loaded NOVALOGO2 into system. 
    call function 'REUSE_ALV_COMMENTARY_WRITE' 
         exporting 
    * I_LOGO = 'NOVALOGO2' 
    * i_logo = 'ENJOYSAP_LOGO' 
             it_list_commentary = gt_list_top_of_page. 
    endform. " TOP_OF_PAGE 
    form comment_build using e04_lt_top_of_page type slis_t_listheader. 
    data: ls_line type slis_listheader. 
          clear ls_line. 
          ls_line-typ = 'A'. 
          ls_line-info = 'Special'(001). 
          fgrant = xgrant. 
          concatenate ls_line-info fgrant 
          'Stock Option Report to the board'(002) 
                 into ls_line-info separated by space. 
                        condense ls_line-info. 
          append ls_line to e04_lt_top_of_page. 
    endform. " COMMENT_BUILD
    Use following syntex for footer print in alv:
    * For End of Page
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *  For End of Report
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    check this link
    http://abapprogramming.blogspot.com/
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
    Changing width of a custom container dynamically
    Display Page numbers in ALV
    Insert picture in selection screen.
    Logo in OO ALV Grid
    Reward all helpfull answers
    Regards
    Pavan

  • Top Of Page in OO ALV

    I want define a header like Top Of Page proprty of Reuse ALV in my OO ALV. But I can give only grid title. Can I define a logo and a few subheader in my OO ALV? (Set_Table_For_First_Display)
    Thanks

    Hi Mehmet,
    i did one sample code, just check it, i documented all required things.
    REPORT  ZTEST1234_ALV_TOP    MESSAGE-ID ZZ                           .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_VALID TYPE C,
          V_FLAG,
          V_DATA_CHANGE,
          V_ROW TYPE LVC_S_ROW,
          V_COLUMN TYPE LVC_S_COL,
          V_ROW_NUM TYPE LVC_S_ROID.
    DATA: IT_ROW_NO TYPE LVC_T_ROID,
          X_ROW_NO TYPE LVC_S_ROID.
    DATA:BEGIN OF  ITAB OCCURS 0,
         VBELN LIKE LIKP-VBELN,
         POSNR LIKE LIPS-POSNR,
         CELLCOLOR TYPE LVC_T_SCOL, "required for color
         DROP(10),
         END OF ITAB.
    "The Below Definitions Must.....
    DATA:
    * Reference to document
           DG_DYNDOC_ID       TYPE REF TO CL_DD_DOCUMENT,
    * Reference to split container
           DG_SPLITTER          TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
    * Reference to grid container
           DG_PARENT_GRID     TYPE REF TO CL_GUI_CONTAINER,
    * Reference to html container
           DG_HTML_CNTRL        TYPE REF TO CL_GUI_HTML_VIEWER,
    * Reference to html container
           DG_PARENT_HTML     TYPE REF TO CL_GUI_CONTAINER.
    "up to here
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN ES_ROW_NO,
        TOP_OF_PAGE FOR EVENT TOP_OF_PAGE              "event handler
                             OF CL_GUI_ALV_GRID
                             IMPORTING E_DYNDOC_ID.
    *        END_OF_LIST FOR EVENT end_of_list              "event handler
    *                         OF CL_GUI_ALV_GRID
    *                         IMPORTING E_DYNDOC_ID.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
    *    MESSAGE I000 WITH V_ROW 'clicked'.
        CLEAR IT_ROW_NO[].
        X_ROW_NO-ROW_ID = V_ROW.
        APPEND X_ROW_NO TO IT_ROW_NO .
        CALL METHOD G_GRID->SET_SELECTED_ROWS
          EXPORTING
            IT_ROW_NO = IT_ROW_NO.
      ENDMETHOD.                    "lcl_event_handler
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW.
        V_COLUMN = E_COLUMN.
        V_ROW_NUM = ES_ROW_NO.
        IF E_COLUMN = 'VBELN'.
          SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        ENDIF.
        IF E_COLUMN = 'POSNR'.
          SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
        ENDIF.
      ENDMETHOD.                    "handle_double_click
    *  METHOD END_OF_LIST.                   "implementation
    ** Top-of-page event
    *    PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
    *  ENDMETHOD.                            "top_of_page
        METHOD TOP_OF_PAGE.                   "implementation
    * Top-of-page event
        PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
      ENDMETHOD.                            "top_of_page
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
    *&             Global Definitions
    DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
                G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
          GS_LAYOUT TYPE LVC_S_LAYO.
    data: v_lines type i.
    data: v_line(3) type c.
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      SELECT VBELN
             POSNR
             FROM LIPS
             UP TO 20 ROWS
             INTO CORRESPONDING FIELDS OF TABLE ITAB.
    describe table itab lines v_lines.
    END-OF-SELECTION.
      IF NOT ITAB[] IS INITIAL.
        CALL SCREEN 100.
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
      "attention.....from here
      "split your container here...into two parts
      "create the container
      CREATE OBJECT G_CUSTOM_CONTAINER
               EXPORTING CONTAINER_NAME = G_CONTAINER1.
      "this is for top of page
    * Create TOP-Document
      CREATE OBJECT DG_DYNDOC_ID
                       EXPORTING STYLE = 'ALV_GRID'.
    * Create Splitter for custom_container
      CREATE OBJECT DG_SPLITTER
                 EXPORTING PARENT  = G_CUSTOM_CONTAINER
                           ROWS    = 2
                           COLUMNS = 1.
    * Split the custom_container to two containers and move the reference
    * to receiving containers g_parent_html and g_parent_grid
      "i am allocating the space for grid and top of page
      CALL METHOD DG_SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 1
          COLUMN    = 1
        RECEIVING
          CONTAINER = DG_PARENT_HTML.
      CALL METHOD DG_SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 2
          COLUMN    = 1
        RECEIVING
          CONTAINER = DG_PARENT_GRID.
    *  CALL METHOD DG_SPLITTER->GET_CONTAINER
    *    EXPORTING
    *      ROW       = 2
    *      COLUMN    = 1
    *    RECEIVING
    *      CONTAINER = DG_PARENT_HTML.
    *  CALL METHOD DG_SPLITTER->GET_CONTAINER
    *    EXPORTING
    *      ROW       = 1
    *      COLUMN    = 1
    *    RECEIVING
    *      CONTAINER = DG_PARENT_GRID.
      "you can set the height of it
    * Set height for g_parent_html
      CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
        EXPORTING
          ID     = 1
          HEIGHT = 5.
      "from here as usual..you need to specify parent as splitter part
      "which we alloted for grid
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = DG_PARENT_GRID.
    * Set a titlebar for the grid control
      CLEAR GS_LAYOUT.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
      GS_LAYOUT-ZEBRA = SPACE.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
    *  SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
      SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
      DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
      DATA: L_INDEX TYPE SY-TABIX.
      "Here i am changing the color of line 1,5,10...
      "so you can change the color of font conditionally
      LOOP AT ITAB.
        L_INDEX = SY-TABIX.
        IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
          LS_CELLCOLOR-FNAME = 'VBELN'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
          LS_CELLCOLOR-FNAME = 'POSNR'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
        ENDIF.
      ENDLOOP.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
      PERFORM  SET_DRDN_TABLE.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
    **Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
      "do these..{
    * Initializing document
      CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
    * Processing events
      CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
          I_EVENT_NAME = 'TOP_OF_PAGE'
          I_DYNDOC_ID  = DG_DYNDOC_ID.
      "end }
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      -->PT_EXCLUDE text
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA: L_POS TYPE I.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-HOTSPOT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
      X_FIELDCAT-FIELDNAME = 'DROP'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      X_FIELDCAT-EDIT = 'X'.
      X_FIELDCAT-DRDN_HNDL = '1'.
      X_FIELDCAT-DRDN_ALIAS = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
    ENDFORM.                    " build_fieldcat
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  SET_DRDN_TABLE
    *       text
    FORM SET_DRDN_TABLE.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL.
      LOOP AT ITAB .
    * First listbox (handle '1').
        IF SY-INDEX = 1.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ' '.
          LS_DRAL-INT_VALUE =  ' '.
        ELSE.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ITAB-POSNR.
          LS_DRAL-INT_VALUE =  ITAB-POSNR.
        ENDIF.
        APPEND LS_DRAL TO LT_DRAL.
      ENDLOOP.
    **Setting the Drop down table for Reason Code
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    ENDFORM.                               " set_drdn_table
    *&      Form  EVENT_TOP_OF_PAGE
    *       text
    *      -->DG_DYNDOC_ID  text
    FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
      "this is more clear.....check it
      "first add text, then pass it to comentry write fm
      DATA : DL_TEXT(255) TYPE C.  "Text
    * Populating header to top-of-page
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
          TEXT      = 'Test Report'
          SAP_STYLE = CL_DD_AREA=>HEADING.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move program ID
      CONCATENATE 'Program Name :' SY-REPID
             INTO DL_TEXT SEPARATED BY SPACE.
    * Add Program Name to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move User ID
      CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
    * Add User ID to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move count (no of records).
      move v_lines to v_line.
      CONCATENATE 'No of records :' v_line INTO DL_TEXT SEPARATED BY SPACE.
    * Add Client to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move date
      WRITE SY-DATUM TO DL_TEXT.
      CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Date to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move time
      WRITE SY-UZEIT TO DL_TEXT.
      CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Time to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    * Populating data to html control
      PERFORM HTML.
    ENDFORM.                    " EVENT_TOP_OF_PAGE
    *&      Form  ADD_TEXT
    *       To add Text
    FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
    * Adding text
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
          TEXT         = P_TEXT
          SAP_EMPHASIS = CL_DD_AREA=>HEADING.
    ENDFORM.                    " ADD_TEXT
    *&      Form  HTML
    *       text
    FORM HTML.
      DATA : DL_LENGTH  TYPE I,                           " Length
             DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
    * Creating html control
      IF DG_HTML_CNTRL IS INITIAL.
        CREATE OBJECT DG_HTML_CNTRL
             EXPORTING
                  PARENT    = DG_PARENT_HTML.
      ENDIF.
    * Reuse_alv_grid_commentary_set
      CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
        EXPORTING
          DOCUMENT = DG_DYNDOC_ID
          BOTTOM   = SPACE
        IMPORTING
          LENGTH   = DL_LENGTH.
    * Get TOP->HTML_TABLE ready
      CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
    * Set wallpaper
      CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
        EXPORTING
          PICTURE_ID = DL_BACKGROUND_ID.
    * Connect TOP document to HTML-Control
      DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
    * Display TOP document
      CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
        EXPORTING
          REUSE_CONTROL      = 'X'
          PARENT             = DG_PARENT_HTML
        EXCEPTIONS
          HTML_DISPLAY_ERROR = 1.
      IF SY-SUBRC NE 0.
        MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
      ENDIF.
    ENDFORM.                    " HTML
    Regards
    vijay

  • To display posting date in alv top of page area for transaction KOB1

    I want to display posting date given on selection screen of transaction KOB1 to the alv top of page area on final alv output .
    what are the possible solutions ?

    I want to display posting date given on selection screen of transaction KOB1 to the alv top of page area on final alv output .
    what are the possible solutions ?

Maybe you are looking for

  • Width of file in Application server

    Hi there, I downloaded a file in application server. In Appl server, it shows a part of data (part of records) which an internal table contains. When I download that file using CG3Y transaction, the file contains same data as it appears in Appl serve

  • PSE 11 Catalog not showing up in Catalog Manager

    My latest battle with PSE11 is trying to access my catalog in PSE11 via the Catalog Manager but it doesn't show up in the list.  The catalog is named My Catalog 2 is located at C:\ProgramData\Adobe\Elements Organizer\Catalogs\My Catalog 2.  It is the

  • Video stream to another network

    Hello, Am christopher from TANZANIA (EAST AFRICAN COUNTRY). Please help me. we have our cable tv and we want to stream it to our another office in another region, where we have configured a VPN in this two offices using cisco router RV180. I have tri

  • Need advice on an Audio Interface for guitar, bass and vocals

    I have a G4 Dual Processor 500. For now I'm using a Griffin 1/4" to 1/8" adapter cable. I plug one end into my guitar and the other into my Microphone jack on the back of my computer. I even tried using a splitter to share my microphone port. This al

  • Itunes Deleted My Music

    I updated ITunes to the latest version and I seem to have deleted my music. I asked my friend who also have the same issue but she said she found her music in one of her school folder after she searched for it. I have gone through my computer, by fol