Table in Header of ALV

Hi,
I want to display header of alv grid in table format with rows and columns. Please suggest on the same. Points will be rewarded.

hi,
     see the below code .this may help u .
*Table declaration.
TABLES:ZEMP_MST,ZDEPT_MST,ZDESG_MST,ZSL_TXN.
*Varriable declaration.
TYPE-POOLS SLIS.
DATA : POS TYPE I.
DATA  REPID  LIKE SY-REPID.
DATA : F1 TYPE SLIS_T_FIELDCAT_ALV,
       F2 TYPE SLIS_FIELDCAT_ALV,
       L_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA  L_POS TYPE I VALUE 1.               "position of the column
DATA  GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
*DATA  GT_SORT TYPE SLIS_T_SORTINFO_ALV.
data:  GT_EVENTS    TYPE SLIS_T_EVENT,
       FS_EVENTCAT LIKE LINE OF GT_EVENTs.
*Internal table declaration.
*DATA  BEGIN OF IT_SORT OCCURS 5.
     INCLUDE TYPE SLIS_SORTINFO_ALV.
*DATA  END OF IT_SORT.
DATA:BEGIN OF ITAB OCCURS 0,
      ZEMPNO    LIKE ZEMP_MST-ZEMPNO,
      ZEMPNAME  LIKE ZEMP_MST-ZEMPNAME,
      ZDEPTCD   LIKE ZEMP_MST-ZDEPTCD,
      ZDEPTNAME LIKE ZDEPT_MST-ZDEPTNAME,
      ZDESGCD   LIKE ZEMP_MST-ZDESGCD,
      ZDESGNAME LIKE ZDESG_MST-ZDESGNAME,
     END OF ITAB.
REFRESH ITAB.CLEAR ITAB.
START-OF-SELECTION.
SELECT AZEMPNO AZEMPNAME AZDEPTCD BZDEPTNAME AZDESGCD CZDESGNAME
       FROM ZEMP_MST AS A
         INNER JOIN ZDEPT_MST AS B
           ON AZDEPTCD EQ BZDEPTCD
         INNER JOIN ZDESG_MST AS C
           ON AZDESGCD EQ CZDESGCD
       INTO CORRESPONDING FIELDS OF TABLE ITAB.
IF SY-SUBRC <> 0.
   MESSAGE E899(M3) WITH 'No records'.
ENDIF.
perform f_build_eventcat.
PERFORM LAYOUT.
END-OF-SELECTION.
*&      Form  LAYOUT
FORM LAYOUT .
  PERFORM FCAT USING 'ZEMPNO'    'ITAB' '' 'Emp.No.'   'ZEMPNO'    'ZEMP_MST'  ''.
  PERFORM FCAT USING 'ZEMPNAME'  'ITAB' '' 'Emp. Name' 'ZEMPNAME'  'ZEMP_MST'  ''.
  PERFORM FCAT USING 'ZDEPTCD'   'ITAB' '' 'Dept.Code' 'ZDEPTCD'   'ZEMP_MST'  ''.
  PERFORM FCAT USING 'ZDEPTNAME' 'ITAB' '' 'Dept.Name' 'ZDEPTNAME' 'ZDEPT_MST' ''.
  PERFORM FCAT USING 'ZDESGCD'   'ITAB' '' 'Desg.Code' 'ZDESGCD'   'ZEMP_MST'  ''.
  PERFORM FCAT USING 'ZDESGNAME' 'ITAB' '' 'Desg.Name' 'ZDESGNAME' 'ZDESG_MST' ''.
PERFORM LSORT USING  'ZEMPNO' 'IDATA' ''.
PERFORM LSORT USING  'ZEMPNAME' 'IDATA' ''.
MOVE IT_SORT[] TO GT_SORT[].
  REPID = SY-REPID.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
         I_CALLBACK_PROGRAM       = REPID
         IT_FIELDCAT              = F1
        IT_SORT                  = GT_SORT
         I_SAVE                   = 'X'
         IT_EVENTS                = GT_EVENTS[]
     TABLES
          T_OUTTAB                 = ITAB.
  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.                    " LAYOUT
*&      Form  FCAT
FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.
  ADD 1 TO POS.
  F2-COL_POS       = POS.
  F2-FIELDNAME     = P_FIELD.
  F2-TABNAME       = P_TABLE.
  F2-SELTEXT_L     = P_TEXT.
  F2-REF_FIELDNAME = P_RFIELD.
  F2-REF_TABNAME   = P_RTABLE.
  F2-DO_SUM        = P_SUM.
  F2-NO_OUT        = P_DISP.
  APPEND F2 TO F1.
  CLEAR F2.
ENDFORM.                " FCAT
*&      Form  LSORT
*FORM LSORT USING P_FIELD P_TABLE P_UP.
ADD 1 TO L_POS.
IT_SORT-SPOS      = L_POS.
IT_SORT-FIELDNAME = P_FIELD.
IT_SORT-TABNAME   = P_TABLE.
IT_SORT-UP        = P_UP.
APPEND IT_SORT.
*ENDFORM.                    " LSORT
FORM F_BUILD_EVENTCAT .
CLEAR: GT_EVENTS.  REFRESH: GT_EVENTS.
  CLEAR: FS_EVENTCAT.
  FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.
  FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.
  APPEND FS_EVENTCAT TO GT_EVENTS.
  CLEAR: FS_EVENTCAT.
  FS_EVENTCAT-NAME = 'END_OF_LIST'.
  FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.
  APPEND FS_EVENTCAT TO GT_EVENTS.
ENDFORM.                    " F_BUILD_EVENTCAT
FORM F_REPORT_HEADER_ALV.
CALL FUNCTION 'Z_YHEAD_PRINT'
EXPORTING
   TITLE1        = 'XYZ Limited'
   TITLE2        = 'Employee Master'
   TITLE3        = 'Created on '
   COLOR         = 'X'
ENDFORM.
*&      Form  F_WRITE_SUMMARY
      Write summary before exit
FORM F_WRITE_SUMMARY .
write:/ 'Welcome to XYZ Limited'.
write:/ 'This is a test program to display Report in ALV Format'.
ENDFORM.

Similar Messages

  • Check Box in Header of ALV GRID only............

    Hi Experts,
                   Can anyone help me out... in keeping the Check box at the Header Level.....
    This requirement is in the copy of the standard transaction "ME2N". 
    1. In ME2N when you click on the Chage Layout button of ALV grid
    and choose "Sorting" tabe.
    2. Add any 3 fields say 1. Vendor/Supply plant 2. Purchasing group and 3. Purchasing document in the Sort criteria and choose accending order radio button and check box in the sum .
    3. Now click on the Displayed Column tab and remove the above 3 fields from the Displayed colums and add it column set
    4. Now report shows the heirarchial one in the sorting manner.
    5. I want the Check Boxes at all levels both in the header and the item level.
    When I click on the Header level check box all the item level check box should get checked. When I add the check box in the field catalog I am able to see the check box in the item level only because only item level data appears in the internal table and Header level is displayed based on the ALV grid sorting option and that row records are unknown in the internal table.
    Is there some thing which I can do to get the check box at the header level retaining all the functionality of ME2N and ALV GRID.....
    It would be great help if some one solves me this issue... Points will be awarded.
    Br,
    Laxmi.

    Hi Bharath,
               Thanks for your response. Select ALL already existing... My requirement is not to get the whole report records selected at  particular level all items and header should get selected. Say for example  I have Vendor2 i.e,  vendor 1 and vendor2. So in the Vendor 1 i will have Purchasing group1 , Purchasing document 1 and say 10 items under Purchasing document. say same as like in Vendor2. So if Click on the Vendor1 all the sub items of it have to selected so that I can perform further action only for these items not for the enter items of the report.
    Br,
    Laxmi.

  • Multiple Heading in ALV Grid

    Hello ,
    I have a requirement to display Multiple heading in ALV Grid, I am using the Class 'cl_gui_alv_grid'. please let me know if you have Any suggestions.
    Ex:
    |                 Divison                     |     
    Sub D:1
    Sub D: 2
    Sub D: 3
        Like wise i have few more divisions to display and Under we need to display the Sub Division also .
    Thanks in Advance..  Waiting for your suggestions.
    With Best Regards
    Nags

    Hi,
    I had attempted to do it in the object oriented way, but found no ready solution, so I settled for the below solution.
    Please use the function REUSE_ALV_COMMENTARY_WRITE.
    This allows you to print multiple lines in the header.
    I had a requirement of showing 5 lines in the header.
    So i went on like:
    DATA: it_list_commentary TYPE slis_t_listheader,
               wa_list_commentary TYPE slis_listheader.
    wa_list_commentary-typ = 'H'.
    wa_list_commentary-info = <text>.
    APPEND wa_list_commentary TO it_list_commentary.
    wa_list_commentary-typ = 'S'.
    wa_list_commentary-info = <text>.
    APPEND wa_list_commentary TO it_list_commentary.
    I fed he internal table with all 5 lines like above.
    Finally I called the function.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_list_commentary.
    Regards,
    Prosenjit.
    Edited by: prosenjit chaudhuri on Jan 28, 2009 6:14 AM

  • Header in ALV Report

    Hi All,
    I want to print a report in the following manner:
    DATE:
    CLASS GROUP :
    MATNR   CLASS     ADSIZE
    123          c             col1
    124          c            col2
    156          c             col2
    DATE:
    CLASS GROUP :
    MATNR   CLASS     ADSIZE
    125         a            col3
    128         a            col4
    150          a             col5
    How do i do it...I am planning to do it with REUSE_ALV_LIST _DISPLAY...but i dont know how to print the header..plz help

    <b>Note : In the below   i am passing  my purchase  order Ebeln  with internal table to the Form header so that all purchase  order are passed to Header  by this way you can also pass it  .</b>
    <b>Add Title(heading) to ALV Grid</b>
    In order to insert a report heading in to the ALV grid you need to perform the following steps:
    1. Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'top-of-page' FORM
    2. Create 'top-of-page' FORM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    Form top-of-page.
    *ALV 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-ebeln.
      append wa_header to t_header.
      clear wa_header.
    endform.
    reward points if it is usefull .....
    Girish

  • Header in alv grid using class

    Hello All,
        I developed alv grid using class method.
    First I created CREATE OBJECT GR_CCONTAINER
    then  CREATE OBJECT GR_ALVGRID
    then  PERFORM FIELD_CATALOG TABLES GT_FIELDCAT----
    for field catalog
        PERFORM LAYOUT CHANGING GS_LAYOUT.----
    for header
        p_gs_layout-grid_title = 'class method'.
      p_gs_layout-sel_mode = 'D'.
      APPEND P_GS_LAYOUT TO IT_LAYOUT.
    and finally CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
    the report is cooming fine but in header it comes only "class method".
    but i need also
    1. reporting date
    2. reporting time.
       can any body tell me how i can i put 2 more heading line
    Thanks,
    Rakesh

    Hi Dude,
    Please refer the below link how to handle  the header in alv using abap oo
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abapObjects-ALVModel-UsingHeaderand+Footer
    Hope it clears,..............
    Thanks & Regards
    Ramakrishna Pathi

  • Header in alv pop up

    Hello,
    i need to dislay header as well as item details in an alv pop up. I am using FM REUSE_ALV_POPUP_TO_SELECT. but I am not able to get the header information. I am able to get the item details for a particular Purchase order number. I need to display purchase order number in the header of alv POPUP.
    how can i achieve this using the same FM?

    hi
    hope this wil help to u
    ...tables vbak.
    data it_vbak like vbak occurs 0 with header line.
    selection-screen begin of block b1 with frame.
    parameters: alv1 radiobutton group alv, "REUSE_ALV_LIST_DISPLAY
    alv2 radiobutton group alv, "REUSE_ALV_POPUP_TO_SELECT
    alv3 radiobutton group alv, "REUSE_ALV_GRID_DISPLAY
    alv4 radiobutton group alv. " NORMAL DISPLAY
    selection-screen end of block b1.
    select * from vbak
    into corresponding fields of table it_vbak
    up to 10 rows.
    if alv1 = 'X'. perform alv_func1.
    elseif alv2 = 'X'. perform alv_func2.
    elseif alv3 = 'X'. perform alv_func3.
    elseif alv4 = 'X'. perform norm.
    endif.
    **& Form ALV_FUNC1
    *form alv_func1 .
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_structure_name = 'VBAK'
    tables
    t_outtab = it_vbak
    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. " ALV_FUNC1
    **& Form ALV_FUNC2
    *form alv_func2 .
    call function 'REUSE_ALV_POPUP_TO_SELECT'
    exporting
    i_title = 'SALES ORDER INFO'
    i_zebra = 'X'
    i_tabname = 1
    i_structure_name = 'vbak'
    tables
    t_outtab = it_vbak
    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. " ALV_FUNC2
    **& Form ALV_FUNC3
    *form alv_func3 .
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_structure_name = 'vbak'
    i_grid_title = 'SALES ORDER INFO'
    tables
    t_outtab = it_vbak
    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. " ALV_FUNC3
    **& Form NORM
    *form norm .
    format intensified.
    skip 1.
    write: /'SALES DOC.',
    ' Created on ',
    ' Time',
    ' Created by',
    ' Valid from ',
    ' Sold-to party'.
    format intensified off. skip 2.
    loop at it_vbak.
    write: / it_vbak-vbeln,
    it_vbak-erdat,
    it_vbak-erzet,
    it_vbak-ernam,
    it_vbak-angdt,
    it_vbak-kunnr.
    endloop.
    endform. " NORM 
    Edited by: Nawanandana Edirisinghe on Sep 3, 2009 12:52 PM

  • Header in ALV using Oops

    I need to display Table header in ALV using Oops.
    I need to data from 8 fields which I get in the run time of the program.
    I am new to Oops ALV, I have done a similar thing in normal ALV but not in oops.
    Detailed info required, Custom container settings as well.
    Thanks in Advance

    see this weblog TOP_OF_PAGE in ALV  Using CL_GUI_ALV_GRID

  • Displaying a header on alv list

    hi there,
    i want to display a header on alv list.
    i have already used
    call method alvgrid->set_table_for_first_display
    regrads

    Hi,
    use the TOP_OF_PAGE event and add the event to the IT_EVENTS internal table..
    In the subroutine that is assigned to the event..
    FORM top_of_page.
            CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
              EXPORTING
                it_list_commentary = heading.
    ENDFORM.
    Thanks,
    Naren

  • Multiple line header for ALV

    I am using  CL_SALV_TABLE (List_Display = X) to create a ALV report. I am willing to change it to function module REUSE_ALV_LIST_DISPLAY if it serves my requirement.
    The header for the report needs to be multiple lines (8 lines). How can I accomplish this?
    I looked into the possibility of using TOP_OF_PAGE event but I will have to hard code the vertical positions of the headers and since it is ALV and you can remove columns at will, I dont think this solution will work. Also if the columns are optimized or output length changed by the user, the positioning of the headers will be ruined.
    Currently the header can only be of one line, how can we make the header to display a table of contents.
    H1-L1          H2-L1          H3-L1
    H1-L2          H2-L2          H3-L2
    H1-L3          H2-L3          H3-L3
    H1-L4          H2-L4          H3-L4
    H1-L5          H2-L5          H3-L5
    H1-L6          H2-L6          H3-L6
    H1-L7          H2-L7          H3-L7
    H1-L8          H2-L8          H3-L8
    Thank you.

    Please guide me hw to put internal table field at report header in ALV.
    this is my field catalog.
    wa_fieldcat-row_pos = 1.
      wa_fieldcat-col_pos = 1.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'VBELN'.
      wa_fieldcat-seltext_m = 'SalesOrderNo'.
      wa_fieldcat-outputlen = '10'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Also i wnt to total 4 field at header level and other is detail level.
    Please guide me hw to do.
    thnks
    Bhavesh

  • Adding header to ALV

    Hi Friends
    I need to add header to ALV grid, pls tell me how to do it.
    Thanx in advance,
    Regards,
    Venu.

    *& Report  Y_TOP_PAGE                                                  *
    REPORT  y_top_page                              .
    TABLES : mara.
    TYPE-POOLS: slis.
    DATA : w_repid LIKE sy-repid.
      w_repid = sy-repid.
    DATA : BEGIN OF it_mara OCCURS 0,
           matnr LIKE mara-matnr,
           END OF it_mara.
    *layout
    DATA: wa_layout           TYPE SLIS_LAYOUT_ALV.
    *field catalog
    DATA: it_fieldcat_wrt_off TYPE slis_t_fieldcat_alv,
          wa_fieldcat_wrt_off TYPE slis_fieldcat_alv.
    START-OF-SELECTION.
      SELECT matnr FROM mara INTO CORRESPONDING FIELDS OF TABLE it_mara.
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         i_program_name               = w_repid
       I_INTERNAL_TABNAME           = 'IT_MARA'
    *     i_structure_name             = 'IT_MARA'
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = w_repid
    *   I_BYPASSING_BUFFER           =
    *   I_BUFFER_ACTIVE              =
        CHANGING
          ct_fieldcat                  = it_fieldcat_wrt_off[]
       EXCEPTIONS
         inconsistent_interface       = 1
         program_error                = 2
         OTHERS                       = 3
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = w_repid
          i_callback_top_of_page = 'TOP-OF-PAGE'
          is_layout              = wa_layout
          it_fieldcat            = it_fieldcat_wrt_off
        TABLES
          t_outtab               = it_mara
        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.
    * 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 = 'CHANDU 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.                    "top-of-page

  • Adding header to alv(factory) in container

    Hi frends!
    How can I add a header to alv in container using factory method?

    You can use splitter. For example :
    REPORT  ZCE_TEST2.
    DATA: IT_FLIGHT TYPE TABLE OF SFLIGHT.
    DATA: OK_CODE LIKE SY-UCOMM,
    SAVE_OK LIKE SY-UCOMM.
    DATA:  G_CONTAINER TYPE SCRFNAME VALUE 'CONTROL',
    O_DYNDOC_ID  TYPE REF TO CL_DD_DOCUMENT,
    O_SPLITTER   TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
    O_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
    O_PARENT_TOP TYPE REF TO CL_GUI_CONTAINER,
    O_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER.
    CLASS LCL_EVENT_HANDLER DEFINITION .
    PUBLIC SECTION .
    METHODS:
    TOP_OF_PAGE FOR EVENT TOP_OF_PAGE
           OF CL_GUI_ALV_GRID
           IMPORTING E_DYNDOC_ID.
    ENDCLASS.             "lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    METHOD TOP_OF_PAGE.
    PERFORM EVENT_TOP_OF_PAGE USING O_DYNDOC_ID.
    ENDMETHOD.                            "top_of_page
    ENDCLASS.       "LCL_EVENT_HANDLER IMPLEMENTATION
    DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
    START-OF-SELECTION.
    SELECT *
    FROM SFLIGHT
    UP TO 20 ROWS
    INTO TABLE IT_FLIGHT.
    END-OF-SELECTION.
    IF NOT IT_FLIGHT[] IS INITIAL.
    CALL SCREEN 100.
    ELSE.
    MESSAGE  'NO DATA FOR THE SELECTION' TYPE 'I'.
    ENDIF.
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'STATUS'.
    SET TITLEBAR 'TITLE'.
    IF G_CUSTOM_CONTAINER IS INITIAL.
    PERFORM CREATE_AND_INIT_ALV.
    ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    FORM CREATE_AND_INIT_ALV .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    CREATE OBJECT G_CUSTOM_CONTAINER
    EXPORTING CONTAINER_NAME = G_CONTAINER.
    Create TOP-Document
    CREATE OBJECT O_DYNDOC_ID
    EXPORTING STYLE = 'ALV_GRID'.
    Create Splitter for custom_container
    CREATE OBJECT O_SPLITTER
    EXPORTING PARENT  = G_CUSTOM_CONTAINER
    ROWS    = 2
    COLUMNS = 1.
      CALL METHOD O_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 1
        COLUMN = 1
        RECEIVING
        CONTAINER = O_PARENT_TOP.
      CALL METHOD O_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 2
        COLUMN = 1
        RECEIVING
        CONTAINER = O_PARENT_GRID.
    Set height for g_parent_html
      CALL METHOD O_SPLITTER->SET_ROW_HEIGHT
        EXPORTING
        ID = 1
        HEIGHT = 5.
    CREATE OBJECT G_GRID
    EXPORTING I_PARENT = O_PARENT_GRID.
    CREATE OBJECT G_HANDLER.
    SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
    *Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
        I_STRUCTURE_NAME = 'SFLIGHT'
        CHANGING
        IT_OUTTAB = IT_FLIGHT[].
      CALL METHOD O_DYNDOC_ID->INITIALIZE_DOCUMENT
        EXPORTING
        BACKGROUND_COLOR = CL_DD_AREA=>COL_TEXTAREA.
    Processing events
      CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
        I_EVENT_NAME = 'TOP_OF_PAGE'
        I_DYNDOC_ID = O_DYNDOC_ID.
    ENDFORM.                     "CREATE_AND_INIT_ALV
    FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
    DATA : DL_TEXT(255) TYPE C.  "Text
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = 'Flight Details'
        SAP_STYLE = CL_DD_AREA=>HEADING
        SAP_FONTSIZE = CL_DD_AREA=>LARGE
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP
        EXPORTING
        WIDTH = 200.
      CALL METHOD O_DYNDOC_ID->ADD_PICTURE
        EXPORTING
        PICTURE_ID = 'ENJOYSAP_LOGO'.
    Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    program ID
    DL_TEXT = 'Program Name :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->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 O_DYNDOC_ID->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 DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    CLEAR : DL_TEXT.
    program ID
    DL_TEXT = 'User Name :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->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-UNAME.
      CALL METHOD O_DYNDOC_ID->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 DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    Run Date
    DL_TEXT = 'Run Date :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    CLEAR DL_TEXT.
    Move date
    WRITE SY-DATUM TO DL_TEXT.
      CALL METHOD O_DYNDOC_ID->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 DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    *Time
    DL_TEXT = 'Time :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    CLEAR DL_TEXT.
    Move time
    WRITE SY-UZEIT TO DL_TEXT.
      CALL METHOD O_DYNDOC_ID->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 DG_DYNDOC_ID->NEW_LINE.
    PERFORM DISPLAY.
    ENDFORM.                    " EVENT_TOP_OF_PAGE
    FORM DISPLAY.
    Creating html control
      IF O_HTML_CNTRL IS INITIAL.
        CREATE OBJECT O_HTML_CNTRL
             EXPORTING
                  PARENT    = O_PARENT_TOP.
      ENDIF.
      CALL METHOD O_DYNDOC_ID->MERGE_DOCUMENT.
      O_DYNDOC_ID->HTML_CONTROL = O_HTML_CNTRL.
    Display document
      CALL METHOD O_DYNDOC_ID->DISPLAY_DOCUMENT
        EXPORTING
          REUSE_CONTROL      = 'X'
          PARENT             = O_PARENT_TOP
        EXCEPTIONS
          HTML_DISPLAY_ERROR = 1.
      IF SY-SUBRC NE 0.
      MESSAGE 'Error in displaying top-of-page' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " display

  • Showing header for ALV tree

    Hi Friends,
    I want to show header for ALV tree.
    Can anybody help me?
    Thanks,
    Rohit

    Hi,
    Go through this code sample:
    U  should give form name in i_callback_top_of_page pararameter of function:
    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_html_end_of_list = 'END_OF_LIST_HTML'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    and create a form like this :
    wa_header-typ = 'S'.
    wa_header-key = 'Report '.
    Concatenate sy-repid 'Date : '
    v_date into wa_header-info
    SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    wa_header-info = sy-repid.
    append wa_header to t_header.
    clear wa_header.
    wa_header-typ = 'S'.
    wa_header-key = 'Report Des '.
    wa_header-info = 'ABAP Report templet'.
    append wa_header to t_header.
    clear wa_header.
    wa_header-typ = 'S'.
    wa_header-key = 'SYS ID : '.
    wa_header-info = sy-sysid.
    append wa_header to t_header.
    clear wa_header.
    wa_header-typ = 'S'.
    wa_header-key = 'Client '.
    wa_header-info = sy-mandt.
    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.
    wa_header-typ = 'S'.
    wa_header-key = 'Run Time '.
    CONCATENATE sy-uzeit(2) '.'
    sy-uzeit+4(2) '.'
    sy-uzeit+2(2) INTO wa_header-info.
    append wa_header to t_header.
    clear wa_header.
    wa_header-typ = 'S'.
    wa_header-key = 'User ID '.
    wa_header-info = sy-uname.
    append wa_header to t_header.
    clear wa_header.
    Total No. of Records Selected
    describe table it_marav 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 = 'logo.gif'.
    endform. "top-of-page
    note : this is populated using FM REUSE_ALV_COMMENTARY_WRITE.
    Hope this will he;lp u.
    Jogdand M B

  • Changing the status of heading in ALV

    HI Gurus,
    I am creating a ALV report program. When I execute the statements (with select options and parameters only)
    I get the output selection screen. But the header comes as the report program name like ZRR_ALV_LIST..
    But I need to change this to some other text of my choice.
    Please help me on this.
    Thanks & Regards,
    Gopinath GS.
    Edited by: Gopigs on May 20, 2011 8:35 AM
    Moderator Message: Basic Question.
    Edited by: kishan P on May 20, 2011 12:31 PM

    This is the simple code that I have done.
    REPORT  zrr_alv_list NO STANDARD PAGE HEADING.
    TABLES:anla.
    TYPE-POOLS: slis.
    SELECTION-SCREEN BEGIN OF BLOCK b100 WITH FRAME TITLE text-bl0.
    SELECT-OPTIONS: s_bukrs FOR anla-bukrs,
                    s_anln1 FOR anla-anln1,
                    s_anln2 for anla-anln2.
      PARAMETERS: p_date LIKE anla-erdat.
    SELECTION-SCREEN END OF BLOCK b100.
    When I execute I get the selection screen. But the header of the selection screen gives the report program name 'zrr_alv_list'.
    Instead i need to put up the header as 'ALV LIST DISPLAY'.
    Also one more query I got just now.
    How can I get the current fiscal year end date and default it to the Parameters field p_date??
    Gs.
    Edited by: Gopigs on May 20, 2011 9:00 AM

  • How to display table data without  using ALV  and table element.

    Hi,
            Its possible to display table data without using ALV  and table element.
           Every time i am fetching data based on (customer,status) fields and displaying these data in my output using alv
           (every time i am fetching single row data ),
           But problem is alv occupying more space in the output , i want to display data part only i dont want field names,
           settings and header data etc..things.
          Give solution to  display data part..
    Regards,
    Rakhi.

    Hi,
    Does you mean that you need ALV without default Function Toolbar...? If this is the case, the easy solution would have been to use Table Element rather. But, if you need to use ALV only without Function Toolbar, you can do away with that as well.
    In that case, after calling GET_MODEL, you need to add few more lines of codes to achieve your goal. Those lines are --
      DATA LV_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
        LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
    * Standard Filter Function setting to FALSE
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_COMPLEX_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_COMPLEX_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_FILTERLINE_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_DISPLAY_SETTINGS_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_HEADERCLICK_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_HIERARCHY_ALLOWED( ABAP_FALSE ).
    * Standard Filter Function setting to FALSE Ends
    Here as you can easily notice that LV_VALUE is instantiated on CL_SALV_WD_CONFIG_TABLE. Now, using this LV_VALUE, you set standard functions as False to dis-allow their display.
    Hope this answers your query.
    Thanks.
    Kumar Saurav.

  • How to add header in ALV

    Hi Friends,
    How to add a header in ALV, Can you please tell me.
    Regards,
    Venu.

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

Maybe you are looking for

  • New Drobo with fire wire

    My Imac 24 3.06 seems to take longer booting up since installing the fire wire drobo with two 1.5TB drives

  • ESPN HD GLITCHING

    I have my entire home theater run through a Pioneer 1021 receiver via HDMI.  The only problem I have is that ESPN HD (channel 570 here) is super glitchy about 85% of the time it's on.  No other channel has this problem (HD or not).  I've tried numero

  • Best way to read text files at multiple production sites

    Need to write a solution to read txt files that contain binary data on multiple SQL Servers. I have no control over the SQL servers, they are not mine. Thinking of BULK INSERT or bcp. But must something on the server be turned on for it to work? What

  • I am having a problem finding a child node (c#)

    Hi ! My XML is a bit like this: <Layers> <Layer> <OverlapNames> </OverlapNames> <CommonNames> </CommonNames> <SnapNames> <SnapName Name="zzz" /> <SnapName Name="yyy" /> </SnapNames </Layer> </Layers> I have this initial XmlNode which returns a valid

  • 500 interal error when click a jsp

              hi.           i am using virtual host in weblgoic6.1sp2 Redhat6.2.           under vistal host, there is a simple jsp.           only just do response.redirect().           but got following error in weblogic.log:           java.lang.NullPo