ALV with splitter container in background

Hi all,
I have an ALV grid in which I am using a splitter container to display top of page and the alv grid.
I am unaware how to use a docking container in conjunction with a splitter container, so that the ALV list is displayed in the background.
Request assistance from you all...
Regards,
Vidya.

Hi,
In background , you can't dispaly the ALV with splitter container , dispaly ALV in foreground with splitter and in background use top-of-page to display header text with docking container.
Code :
DATA: o_grid             TYPE REF TO cl_gui_alv_grid,
      o_container TYPE REF TO cl_gui_custom_container,
      o_dockingcontainer TYPE REF TO cl_gui_docking_container .
  IF NOT sy-batch = 'X'.
    CREATE OBJECT o_container
            EXPORTING
                  container_name = 'CONTAINER'.
    CREATE OBJECT o_grid
            EXPORTING
                  i_parent = o_container.
  ELSE.
    CREATE OBJECT o_grid
      EXPORTING
     i_parent = o_dockingcontainer.
    IF sy-subrc NE 0.
    ENDIF.
  ENDIF
METHOD handle_print_top_of_page.
    prev_linno = sy-linno.
    sy-linno = 64.
    SKIP.
    WRITE:/40 'Page:', sy-pagno .
    SKIP.
    sy-linno = prev_linno.
  ENDMETHOD.                    "handle_print_top_of_page
  METHOD handle_top_of_page.
    WRITE:/40 'Page:', sy-pagno .
  ENDMETHOD.                    "handle_top_of_page
Regards
Appana

Similar Messages

  • TWO ALV USING SPLITTER CONTAINER

    HI ALL.
    I WANT TO DISPLAY TWO DIFFERENT ALV USING SPLITTER.
    ON DOUBLE CLICKING THE FIRST ALV THE SECOND ALV GET CALLED RESPECTIVE OF THE FIELDS I CHOOSE ON CLICKING
    THE FIRST LIST IS IN LEFT SPLITTER . AND THE SECOND LIST IS  IN RIGHT SPLITTER .
    Moderator message: many examples are available, please search before asking, do not post in all upper case in these forums.
    Edited by: Thomas Zloch on Dec 2, 2010 1:08 PM

    Hi,
    CREATE OBJECT g_custom_container
        EXPORTING
          container_name = 'CONTAINER'.
    CREATE OBJECT g_custom_container1
        EXPORTING
          container_name = 'CONTAINER1'.
    CREATE OBJECT g_splitter
                      EXPORTING parent = G_CUSTOM_container
                                rows    = 1
                                columns = 2.
    CALL METHOD g_splitter->get_container
                          EXPORTING row      = 1
                                    column   = 1
                          RECEIVING container = g_container_1.
        CALL METHOD g_splitter->get_container
                      EXPORTING row      = 1
                                column   = 2
                      RECEIVING container = g_container_2.
    CREATE OBJECT g_splitter1
                      EXPORTING parent = G_CUSTOM_container
                                rows    = 1
                                columns = 2.
    CALL METHOD g_splitter->get_container
                          EXPORTING row      = 1
                                    column   = 1
                          RECEIVING container = g_container_1.
        CALL METHOD g_splitter->get_container
                      EXPORTING row      = 1
                                column   = 2
                      RECEIVING container = g_container_2.
    CALL METHOD g_splitter->get_container
                      EXPORTING row      = 1
                                column   = 2
                      RECEIVING container = g_container_2.
    call method g_splitter1----
    >set_table_for_first_display.
    call method g_splitter2----
    >set_table_for_first_display.
    regards,
    muralii

  • How to display 3 alv with top-of-page using splitter container

    Hi,
    I want to display 3 different alv in a single container corresponding to the 3 check boxes on selection screen.
    i.e.
    If user selects 1 check box only one alv should be displayed, if 2 checkboxes selected by user 2 alv should be displayed and same for 3.
    I cannot use 3 different containers bcoz if second checkbox is not selected then that place remains blank. So I am using single container and using splitter container dividing it into the no of rows corresponding to the no. of checkboxs selected by user.
    Now I also want to display top-of-page for each alv. Please guide me how to achieve this.
    Thanks & regards,
    Harshada

    create with some IF_ELSE conditions as i have done below. in my case the same things are required. if error table is there only then it will be displayed, else only output will be displayed.
    * First Main Container
      CREATE OBJECT obj_main1
        EXPORTING
          container_name = 'CC_CONTAINER'
          style          = cl_gui_custom_container=>ws_maximizebox.
    * create top-document
      CREATE OBJECT obj_dyndoc_id
        EXPORTING
          style = 'ALV_GRID'.
      IF pr_view EQ c_x OR pr_stat EQ c_x.
    * First Splitter Container
        CREATE OBJECT obj_splitter1
          EXPORTING
            parent  = obj_main1
            rows    = 2
            columns = 1.
    * Place obj_parent_html in First row First column
    * for Top_of_page
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = obj_parent_html.
    * Place obj_container1 in Second row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 2
            column    = 1
          RECEIVING
            container = obj_container1.
    * Set the height of Top of page
        CALL METHOD obj_splitter1->set_row_height
          EXPORTING
            id     = 1
            height = 24.
      ELSEIF pr_email EQ c_x.
    * First Splitter Container
        CREATE OBJECT obj_splitter1
          EXPORTING
            parent  = obj_main1
            rows    = 3
            columns = 1.
    * Place obj_parent_html in First row First column
    * for Top_of_page
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = obj_parent_html.
    * Place obj_container1 in First row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 2
            column    = 1
          RECEIVING
            container = obj_container1.
    * Place obj_container2 in Second row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 3
            column    = 1
          RECEIVING
            container = obj_container2.
    * Set the height of Top of page
        CALL METHOD obj_splitter1->set_row_height
          EXPORTING
            id     = 1
            height = 24.
      ENDIF.
    Please note there is no need to create a hEADER in the container, but create it for the 1st table only which is always displayed
    ags.
    Edited by: ags on Nov 4, 2009 4:49 PM
    Edited by: ags on Nov 4, 2009 4:50 PM

  • Splitter container with alv grid has to be replaced with a dynpro

    I have a container which I have splitt in 4 areas, on the right half I have two splitter container with alv grids.
    On the left side I have my navigation tree in 2 splitter container.
    I don't know if this really works, but is it possible that I call a dynpro in the splitter container (after using my navigation tree) where still my alv grids exist?

    so it is not able that I can show a dynpro with several text fields?
    or can I introduce the textfields in another version to the container?
    In se80 I think you have the same, there they call another transactions, is it possible that I call a transaction to the right side of a splitter container?

  • How splitter container is useful to show multiple lines of heading in ALV

    Hi,
    I have a requirement to develop an ALV grid with below layout:
    Past
    Future
    | F1     | F2   | F3    | F4    | F5  | F6    | F7     | F8      | F9       | F10     | F11     | F12        |  
    I read forum blogs and found that splitter container can be used to develop such layout. Can anybody pleae let me know how to do so? As per my understanding first container will have headings ( Past & Future) and second container will hold headings (F1, F2...) as well as data. Since each container has a grid and for each grid we have to pass a fieldcatlog and an internal table how can we display only headings in First conatiner.
    Rgds
    Sid

    Hi sudhanshu,
    solution may exist in theory (only).
    I do not know a working solution yet. When ALV was first introduced some 12 or more years ago, the column width was specified as a number of characters ignoring that a proportional font will not match this.
    With introduction of the grid, the scaling is free and can be done in the GUI on a (display) pixel base. I tried a lot with dynamic scaling of containers and had to learn that there is still a big optimizing potential for the SAP infrastructure.
    Right now it seems as the architects try to get everything working as well on (old-style) SAP GUI, also WEB GUI, also java-based web services. The downside is that looking at it from the distance it is nice, going into the details, most (or much) is missing, undocumented or not working properly.
    For the time being you may replace detailed functionality by an impressive background picture
    Regards,
    Clemens

  • Show link in ALV with blue background

    I have an ALV with three columns. The first shown an input field, the second a dropdown, and the third a link (linkToUrl).
    The first to columns are either editble or not, depending on a display/edit mode that the user can set. The third column  shall always be not editable.
    This all works fine, now my problem:
    The column with the links has a white background, but I want it to have the same background than the not-editable columns (light blue).
    I tried SET_CELL_DESIGN, but none of the colors there seems to fit. I also tried link->set_editable( false ), which shows the right color, but then, the link is not clickable anymore.
    How can I display a link in an ALV column that has the same background than a non-editable, disabled input field?

    Hi,
    Having concatenatedvalue into once column and showing link to part of cell is not possible. Try to have salesorder and lineitem in 2 columns, and provide the link for salesorder.
    Let your cleint know that the above case(original post) is not possible.
    One more thing, POPINS are  not possible for ALV. Youcan use TABLE UI element for popins.
    Regards,
    Lekha.

  • ABAP Objects: Problems with controls in splitter container

    Hi community,
    I have problems with the second control in a splitter container.
    In the left container I build up a <u>list tree</u>.
    On double click on a node a <u>column tree</u> in the right container is created.
    This is working fine.
    But if I double click on another node in the left container the right tree remains unchanged.
    What do I have to do to update/refresh the tree in the right splitter container.
    Thanks in advance.
    Regards
    Ferdi

    Thanks for your reply Thomas and Serdar,
    I now destroy the right container and the right tree control if it exists after the event 'double_click' on a node in the left tree.
    The result is now that the container is created (I can see it on screen) but no tree is shown.
    If I just destroy the tree control but not the container the tree from the first double click on the left tree is shown.
    In the debugger I see that the list tree instance is linked to the caontainer (after first and second creation of tree control)
    Maybe you can see in the coding below what's wrong or missing.
    Coding after EVENT DOUBLE_CLICK in left Tree: <pre>
    destroy ‘old’ tree instance and container
      if not g_container_2 is initial.
        call method g_container_2->free.
        clear: g_container_2, g_tree_2.
      endif.
    create right container
      call method g_splitter->get_container
                exporting row      = 1
                          column   = 2
                receiving container = g_container_2.
    setup the hierarchy header
      hierarchy_header-heading = 'Hierarchy Header'.
      hierarchy_header-width = 37.       
    create a column tree model instance
      create object g_tree_2
        exporting
          node_selection_mode = cl_column_tree_model=>node_sel_mode_single
          item_selection = 'X'
          hierarchy_column_name = 'C1'
          hierarchy_header = hierarchy_header.
    create tree control
      call method g_tree_2->create_tree_control
        exporting
          parent = g_container_2.
      perform add_columns.
      perform define_events.
    set registered events
      call method g_tree_2->set_registered_events
        exporting
          events = events.
      perform get_data.
      perform add_nodes_2.
    expand the root node
      call method g_tree_2->expand_node
        exporting
          node_key = 'Root'
          level_count = 3.
    </pre>
    Regards
    Ferdi
    Message was edited by: Ferdi Meyer

  • ALV with Check Boxes

    Can I get a sample program of ALV (oops) with check boxes in it. thank you.

    Types: begin of lt_io.
    include structure mara. " Your Structure
    Types: style_table type lvc_t_style.
    Types: end of lt_io.
    data: lt_io type table of lt_io,
    ls_layout type lvc_s_layo,
    lt_fcat type lvc_t_fcat,
    lo_grid type ref to cl_gui_alv_grid.
    field-symbols: <io> type lt_io,
    <fcat> type lvc_s_fcat.
    ... fill your output table ....
    ls_layout-stylefname = 'STYLE_TABLE'.
    loop at lt_io assigning <io>.
    PERFORM set_style USING 'CHECKBOX' "Your Filename
    CHANGING <io>.
    endloop.
    ... Fill Your Field Catalog lt_fcat
    read table lt_fcat assigning <fcat>
    where fieldname = 'CHECKBOX'.
    <fcat>-checkbox = 'X'.
    create grid control lo_grid.
    CALL METHOD lo_grid->set_table_for_first_display
    EXPORTING
    is_layout = ls_layout
    CHANGING
    it_fieldcatalog = lt_fcat
    it_outtab = lt_io[].
    FORM set_button_to_line
    USING iv_fieldname TYPE lvc_fname
    CHANGING cs_io TYPE io.
    DATA: ls_style TYPE lvc_s_styl,
    lt_style TYPE lvc_t_styl.
    ls_style-fieldname = iv_fieldname.
    if cs_io-checkbox = ' '.
    ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
    else.
    ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
    endif.
    ls_style-maxlen = 2.
    INSERT ls_style INTO TABLE io-style_table.
    ENDFORM. "set_icon_to_status_line
    [/code].
    A classical report is a program that generates a single list, which must contain all of the required detail information.
    1) This procedure may result in extensive lists from which the user has to pick the relevant data.
    2) For background processing, this is the only possible method. After starting a background job, there is no way of influencing the program.
    3) The desired selections must be made beforehand and the list must provide detailed information.
    4) For dialog sessions, there are no such restrictions.
    5) The user is present during the execution of the program and can control and manipulate the program flow directly.
    6) To be able to use all advantages of the online environment, classical reporting was developed into interactive reporting.
    ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain up to 90 columns in the display with the wide array of display options.
    Advantages.
    Collapse multiple reports into one, drastically cutting down your report development time
    Save many hours using built-in ALV sorting, subtotaling and filtering capabilities
    Add conditional structures into your ALV report: No programming required!
    Combine ALV with display variants to meet a wide range of reporting requirements more easily
    Dynamically reorder column layouts and add/subtract fields
    Enable users and analysts to save their own personalized variants
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
    iii. I_callback_user_command : routine where the function codes are handled
    iv. I_structure name : name of the dictionary table
    v. Is_layout : structure to set the layout of the report
    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table
    iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
    declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events
    for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
    Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block
    II. it_fieldcat : field catalog
    III. i_tabname : internal table name with output data
    IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the
    output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field
    names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output
    ii. t_outtab_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary)
    E. ref_tabname : table (dictionary)
    F. key(1) : column with key-color
    G. icon(1) : icon
    H. symbol(1) : symbol
    I. checkbox(1) : checkbox
    J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    declarations for spl.group.
    GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV
    GT_SORT TYPE SLIS_T_SORTINFO_ALV, "for sort
    DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
      CLEAR LS_SORT.
      LS_SORT-FIELDNAME = 'FIELD1'.
      LS_SORT-SPOS      = 1.
      LS_SORT-UP        = 'X'.
      ls_sort-subtot    = 'X'. "subtotal
      APPEND LS_SORT TO E06_LT_SORT.
      APPEND LS_SORT TO E06_LT_SORT.
      LS_SORT-FIELDNAME = 'FIELD2'.
      LS_SORT-SPOS      = 2.
      LS_SORT-UP        = 'X'.
      ls_sort-subtot    = 'X'. "subtotal
      APPEND LS_SORT TO E06_LT_SORT.
    for creating the group..
      DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
      CLEAR  LS_SP_GROUP.
      LS_SP_GROUP-SP_GROUP = 'A'.
      LS_SP_GROUP-TEXT     = TEXT-005.
      APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
    and pass this info to FM...
    layout-sUBTOTALS_TEXT = 'SUbt...'
    and pass spl group info to fieldcatalog also...
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM      = G_REPID
                IS_LAYOUT               = GS_LAYOUT
                IT_FIELDCAT             = GT_FIELDCAT[]
                IT_SPECIAL_GROUPS       = GT_SP_GROUP[]
                IT_SORT                 = GT_SORT[]
    TYPES :
      BEGIN OF ty_vbak,
        vkorg TYPE vbak-vkorg,             " Sales organization
        kunnr TYPE vbak-kunnr,             " Sold-to party
        vbeln TYPE vbak-vbeln,             " Sales document
        netwr TYPE vbak-netwr,             " Net Value of the Sales Order
        waerk TYPE vbak-waerk,             " Document currency
      END OF ty_vbak.
    DATA:
      vbak    TYPE vbak,
      gt_vbak TYPE TABLE OF ty_vbak.
    SELECT-OPTIONS :
      s_vkorg FOR vbak-vkorg,              " Sales organization
      s_kunnr FOR vbak-kunnr,              " Sold-to party
      s_vbeln FOR vbak-vbeln.              " Sales document
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
    PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
         Form  f_read_data
    FORM f_read_data.
      SELECT vkorg kunnr vbeln netwr waerk
          UP TO p_max ROWS
        INTO TABLE gt_vbak
        FROM vbak
       WHERE kunnr IN s_kunnr
         AND vbeln IN s_vbeln
         AND vkorg IN s_vkorg.
    ENDFORM.                               " F_READ_DATA
         Form  f_display_data
    FORM f_display_data.
      TYPE-POOLS: slis.                    " ALV Global types
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                  
    Check out these sample programs
    BCALV_GRID_01
    This program illustrates how the events for print processing PRINT_TOP_OF_PAGE,
    PRINT_END_OF_PAGE, PRINT_TOP_OF_LIST,PRINT_END_OF_LIST are handled. The
    corresponding handler methods control the appearance of the list printed.
    BCALV_GRID_02
    Show a detail list in an amodal window. There is no second dynro needed in contrast to
    BCALV_GRID_03.
    BCALV_GRID_03
    This program implements a function on event DOUBLE_CLICK. According to the selected line data
    from table SBOOK is selected and displayed by a second ALV Control in a dialog dynpro.
    BCALV_GRID_04
    Illustrates the use of exceptions (lights or leds). According to the values of SFLIGHT-SEATSOCC, the
    lights are set to 1 (red), 2 (yellow) or 3 (green).
    BCALV_GRID_05
    Demonstrate the creation of an own toolbar button.
    BCALV_GRID_06
    Demonstrate the creation of an own context menu.
    BCALV_GRID_07
    Append a menu button to the standard toolbar.
    BCALV_GRID_08
    Append a menu with default button to the standard toolbar. It is exactly the same as
    BCALVC_TB_WITH_MENU except for methods HANDLE_MENU_BUTTON and HANDLE_TOOLBAR.
    Editable ALV grids
    BCALV_EDIT_01
    This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
    BCALV_EDIT_02
    This report illustrates how to set chosen cells of an ALV Grid Control editable.
    BCALV_EDIT_03
    In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
    The report checks the input value(s) semantically and provides protocol messages in case of error
    BCALV_EDIT_04
    This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
    implement the saving of the new data.
    BCALV_EDIT_05
    This example shows how to use checkboxes within an ALV Grid Control. You learn:
    (1) how to define a column for editable checkboxes for an attribute of your list
    (2) how to evaluate the checked checkboxes
    (3) how to switch between editable and non-editable checkboxes
    BCALV_EDIT_06
    This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
    Grid Control.
    BCALV_EDIT_07
    This example shows how to define dropdown listboxes for particular cells of your output table.
    BCALV_EDIT_08
    This report implements an ALV Grid Control with an application specific F4 help. The following aspects
    are dealt with:
    (1) how to replace the standard f4 help
    (2) how to pass the selected value to the ALV Grid Control
    (3) how to build an f4 help, whose value range depend on a value of another cell.
    Check this link tooo
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/07/23/oopsALVin+ABAP&showComments=true
    The ALV Grid Control is a tool with which you can output non-hierarchical lists in a
    standardized format. The list data is displayed as a table on the screen.
    The ALV Grid Control offers a range of interactive standard list functions that users need
    frequently (find, sort, filter, calculate totals and subtotals, print, print preview, send list,
    export list (in different formats), and so on. These functions are implemented in the
    proxy object class. You as the programmer have the possibility to turn off functions not
    needed. In most cases the implementations of the standard functions provided by the
    control are sufficient. However, if required, you can adjust these implementations to
    meet application-specific needs.
    You can add self-defined functions to the toolbar, if necessary.
    The ALV Grid Control allows users to adjust the layout of lists to meet their individual
    requirements (for example, they can swap columns, hide columns, set filters for the
    data to be displayed, calculate totals, and so on). The settings (list customizing) made
    by a specific user are called a display variant. Display variants can be saved on a userspecific
    or on a global basis. If such display variants exist for a list, they can be offered
    to the user for selection. If a display variant is set as the default variant, the associated
    list is always displayed based on the settings of this variant.
    2. REUSE_ALV_LIST_DISPLAY
    REUSE_ALV_GRID_DISPLAY
    REUSE_ALV_FIELDCATALOG_MERGE
    REUSE_ALV_COMMENTARY_WRITE
    3. Use of Field Catalog is to determines the technical properties & add formating information of the column.
    6. all the definition of internal table, structure, constants are declared in a type-pool called SLIS.
    7.fieldcat-fieldname
    fieldcat-ref_fieldname
    fieldcat-tabname
    fieldcat-seltext_m
    5. Form user_command using r_ucomm like sy-ucomm rs_selfield type slis_selfield.
    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
    In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
    The report output can contain up to 90 columns in the display with the wide array of display options.
    The commonly used ALV functions used for this purpose are;
    1. REUSE_ALV_VARIANT_DEFAULT_GET
    2. REUSE_ALV_VARIANT_F4
    3. REUSE_ALV_VARIANT_EXISTENCE
    4. REUSE_ALV_EVENTS_GET
    5. REUSE_ALV_COMMENTARY_WRITE
    6. REUSE_ALV_FIELDCATALOG_MERGE
    7. REUSE_ALV_LIST_DISPLAY
    8. REUSE_ALV_GRID_DISPLAY
    9. REUSE_ALV_POPUP_TO_SELECT
    Purpose of the above Functions are differ not all the functions are required in all the ALV Report.
    But either no.7 or No.8 is there in the Program.
    How you call this function in your report?
    After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.
    Then use follwing function module.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = 'Prog.name'
    I_STRUCTURE_NAME = 'I_ITAB'
    I_DEFAULT = 'X'
    I_SAVE = 'A'
    TABLES
    T_OUTTAB = I_ITAB.
    IF SY-SUBRC <> 0.
    WRITE: 'SY-SUBRC: ', SY-SUBRC .
    ENDIF.
    ENDFORM. " GET_FINAL_DATA
    The object F_IT_ALV has a field, the activity ACTVT, which can
    contain four permitted values: 01, 02, 03 and 70. Each of the
    activities 01, 02 and 70 controls the availability of particular
    functions (in the menu and the toolbar) of the ALV line item list:
    a) 01: "Settings -> Display variant -> Save..."
    b) 02: "Settings -> Display variant -> Current..." and
    "Settings -> Display variant -> Current header rows "
    c) 70: "Settings -> Display variant -> Administration..."
    Activity 03 corresponds to the minimum authorization, which is the
    most restricted one: The user can only select layouts which have
    been configured already. In particular, all of the other functions
    named above are inactive with activity 03.
    Now if you want to permit a user to change the column selection and
    the headers as well as to save the layout thus created, for example,
    but if you do not want to permit the user to administrate the
    layouts, you grant him or her the authorization for activities 01
    and 02.
    Check this link it will be mosty usefull for u
    http://www.sap-img.com/fu017.htm
    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
    check these links
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Try these links
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    For More alv report examples check these Tcodes LIBS, BIBS Here u can find more number of examples on alv reports of different kinds
    check this sample code for intercative alv report
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.
    ENDFORM.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        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  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH

  • OOP's ALV with top of page

    Hi,
    Does any one have code or pointers for creating a ALV with top of page using OOPS.
    I need to create a top of page with variables like :
    Report Name : ZABC
    User Name : Z234ASD
    Date : System Date
    Time : System Time
    Transaction : ZXYZ
    Thanks
    Khan.

    The code i used to implement top of page for OO ALV is as below but when you proceed to print out the report, it doesn't print out the header as the list output doesn't show the header.
    codeREPORT 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.
    "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.
    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'.
    ENDMETHOD. "lcl_event_handler
    *Handle Double Click
    METHOD HANDLE_DOUBLE_CLICK.
    ENDMETHOD. "handle_double_click
    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.
    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.
    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.
    SELECT VBELN
    POSNR
    FROM LIPS
    UP TO 20 ROWS
    INTO CORRESPONDING FIELDS OF TABLE ITAB.
    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.
    "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->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 Client
    CONCATENATE 'Client :' SY-MANDT 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
    [/code]

  • Change width of splitter container and single container

    Hi,
    im using a splitter container (abap oo style without dnpro elements) with 2 single containers.
    create object go_splitter
        exporting
          parent            = go_docking
          rows              = 1
          columns         = 2
    Column 1 leftside = Tree (width = 100)
    Column 2 rightside = ALV (width = 100)
    Ratio = 50:50
    Is it possible to change width to ratio 30:70
    Example:
    Column 1 leftside = Tree (width = 30)
    Column 2 rightside = ALV (width = 170)
    Ratio: 30:70
    Thanks,
    Gordon
    Edited by: Gordon Breuer on Feb 19, 2009 10:56 AM
    Edited by: Gordon Breuer on Feb 19, 2009 11:04 AM

    Use Method SET_COLUMN_WIDTH & SET_ROW_HEIGHT of Class CL_GUI_SPLITTER_CONTAINER to adjust Width & Height
    CALL METHOD W_L_SPLITTER->SET_ROW_MODE
          EXPORTING
            MODE = W_L_SPLITTER->MODE_ABSOLUTE.
        CALL METHOD W_L_SPLITTER->SET_ROW_HEIGHT
          EXPORTING
            ID     = 1
            HEIGHT = 80.

  • Docking and splitter container

    Hi,
    I need to create 2 containers as per the attached document, that are resizeable in both x and y axis.
    I have been able to do this, similar to in transaction DWDM, where I have 2 cl_gui_container's inside a customer container.
    But this solution does not allow resizing in the vertical axis, as they are tied inside the "fixed" customer container.
    Is there a way to create the docking and splitters that allow both axis resizing?
    Thanks
    Tony

    Hi Tony,
    of course you can create both types of containers (docking and Splitter).
    Here is an example to create a splitter container :
    Data declarations:
    DATA: lo_gui_container_head     TYPE REF TO cl_gui_container,
             lo_gui_container_costs    TYPE REF TO cl_gui_container,
             lo_gui_splitter_container TYPE REF TO cl_gui_splitter_container,
             lo_event_receiver         TYPE REF TO lcl_event_receiver,
             lo_event_receiver_head    TYPE REF TO lcl_event_receiver_head,
             lo_custom_container_head  TYPE REF TO cl_gui_custom_container.
    part from the source code :
    CREATE OBJECT lo_custom_container_head
           EXPORTING
             container_name = 'ALV_GRID'.
    *Create SPLITTER and SPLITTER panes
    * here we can define if splitters are horizontal or vertical:
         IF rb_hori IS INITIAL.
           lv_rows = 2.
           lv_columns = 1.
         ELSE.
           lv_rows = 1.
           lv_columns = 2.
         ENDIF.
    * create splitter:
         CREATE OBJECT lo_gui_splitter_container
           EXPORTING
             parent  = lo_custom_container_head
             rows    = lv_rows
             columns = lv_columns.
    * Splitter for Header
         CALL METHOD lo_gui_splitter_container->get_container
           EXPORTING
             row       = 1
             column    = 1
           RECEIVING
             container = lo_gui_container_head.
         CALL METHOD lo_gui_splitter_container->set_row_height
           EXPORTING
             id     = 1
             height = 20.
         IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
    * 2nd Spiltter for details:
         CALL METHOD lo_gui_splitter_container->get_container
           EXPORTING
             row       = lv_rows
             column    = lv_columns
           RECEIVING
             container = lo_gui_container_costs.
    * splitter for header
         CREATE OBJECT alv_head
           EXPORTING
             i_parent = lo_gui_container_head.
    * Objekt ALV grid mit splitter anlegen:
         CREATE OBJECT alv_grid
           EXPORTING
             i_parent = lo_gui_container_costs.
    * create handlers for both spitters :
    CREATE OBJECT lo_event_receiver_head.
         CREATE OBJECT lo_event_receiver.
         SET HANDLER lo_event_receiver->handle_hotspot_click            FOR alv_grid.
         SET HANDLER lo_event_receiver_head->handle_double_click        FOR alv_head.
         SET HANDLER lo_event_receiver_head->handle_toolbar             FOR alv_head.
         SET HANDLER lo_event_receiver_head->handle_before_user_command FOR alv_head.
         SET HANDLER lo_event_receiver_head->handle_hotspot_click_head  FOR alv_head.
    * display both tables in the spitters:
    CALL METHOD alv_head->set_table_for_first_display
           EXPORTING
             is_layout            = ls_layout
             it_toolbar_excluding = lt_toolbar_excluding[]
             i_default            = lv_default
             i_save               = lv_save
             is_variant           = ls_disvarhead
           CHANGING
             it_outtab            = gt_head[]
             it_fieldcatalog      = gt_cathead.
         CALL METHOD alv_grid->set_table_for_first_display
           EXPORTING
             is_layout            = ls_layout
             is_variant           = ls_disvariant
             i_default            = lv_default
             i_save               = lv_save
             it_toolbar_excluding = lt_toolbar_excluding[]
           CHANGING
             it_outtab            = gt_details[]
             it_fieldcatalog      = gt_fieldcatalog[]
             it_filter            = gt_filter[].
    Hope this helps
    Regards
    Fred

  • Splitter-container calling standard transaction

    We want to create a splitter-container with two elements:
    - Left side displays a control tree (this is OK)
    - Right side displays a standard transaction such as VA03 (not sure how to do this bit)
    Any help would be greatfully received
    PeteA

    Hi,
    Here is a sample program which implements a docking container with a splitter.
    data: docking_left     type ref to cl_gui_docking_container,
          dock_sub_cont1   type ref to cl_gui_container,
          dock_sub_cont2   type ref to cl_gui_container,
          alv_bottom       type ref to cl_gui_alv_grid,
          splitter         type ref to cl_gui_splitter_container,
          html_viewer type ref to cl_gui_html_viewer.
    parameters: p_check.
    at selection-screen output.
      data: it001w type table of t001w with header line.
      data: repid type sy-repid.
      data: url(255).
      repid = sy-repid.
      if docking_left is initial.
    Create the docking and splitter containers
        create object:
             docking_left
                    exporting repid     = repid
                              dynnr     = sy-dynnr
                              side      = docking_left->dock_at_left
                              extension = 525,
             splitter
                      exporting parent = docking_left
                                rows    = 2
                                 columns = 1.
    Set the splitters.
        call method:
                    splitter->set_border
                      exporting border = space,
                    splitter->get_container
                      exporting row            = 1
                                column         = 1
                                receiving container = dock_sub_cont1,
                    splitter->set_row_height
                      exporting id             = 1
                                height         = '25',
                    splitter->get_container
                      exporting row            = 2
                                column         = 1
                                receiving container = dock_sub_cont2.
    HTML control in the first container
        create object html_viewer
                exporting  parent              = dock_sub_cont1
                exceptions cntl_error         = 1
                           cntl_install_error = 2
                           dp_install_error   = 3
                           dp_error           = 4.
        call method:
        html_viewer->load_mime_object
                   exporting
                     object_id  = 'HTMLCNTL_TESTHTM2_SAPLOGO'
                     object_url = 'SAPLOGO.GIF'
                   importing
                     assigned_url = url
                   exceptions object_not_found     = 1
                              dp_error_general     = 2
                              dp_invalid_parameter = 3,
         html_viewer->show_data
             exporting url   = url
             exceptions cntl_error = 1.
    ALV grid in second splitter container.
        select * into corresponding fields of table it001w
                    from t001w.
        create object alv_bottom
                      exporting i_parent = dock_sub_cont2.
        call method alv_bottom->set_table_for_first_display
            exporting
                 i_structure_name       = 'T001W'
            changing
                 it_outtab       = it001w[].
      endif.
    *Reward points
    Regards

  • Splitter container titles

    hi,
    I have a splitter container that generates a variable amount of rows depending on the users requirements.
    Each container will then contain either an ALV grid, HTML Viewer or some other type of GUI control.
    What I would like to do is have a title in each splitter container visible on the screen.
    Is this possible ?
    Cheers

    Hi Rob,
    All the examples I could find using the FM were all ALV.
    However, it did point me in the direction of the class CL_DD_DOCUMENT.
    I now split each conainer into a small top area and a large main area. The main area copes with the HTML_VIEWERS, ALV, Calendars etc.
    I use the small top area for a CL_DD_DOCUMENT which I can add a text to which appears a nice title.
    Thanks for your help in pointing me towards a solution.
    Cheers
    James

  • How To Refer instance of splitter container to an CL_DD_DOCUMENT object?

    Hi All,
    When we try to use a splitter container,we are not able to assign it to CL_DD_DOCUMENT object,which is used to display the logo.
    In the other part of the splitter, we are able to display the ALV grid.
    In the code, the method 'DISPLAY_DOCUMENT' is not accepting an object of a splitter container.
    Thanks And Regards,
    Feros Khan.
    CALL METHOD g_splittercontainer->get_container
      EXPORTING
        row       = 1
        column    = 1
      receiving
        container = g_splitlogo.
    CALL METHOD g_splittercontainer->get_container
      EXPORTING
        row       = 2
        column    = 1
      receiving
        container = g_splitalv.
          CREATE OBJECT g_logocontainer.
          CALL METHOD g_logocontainer->add_picture
            EXPORTING
              picture_id       = 'ENJOYSAP_LOGO'
              width            = '125%'.
          CALL METHOD g_logocontainer->merge_document.
    *      CALL METHOD g_logocontainer->display_document
    *        EXPORTING
    *          container          = g_splitlogo
    *        EXCEPTIONS
    *          html_display_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.

    Hi,
    Take a look at a similar post at How To use TOP OF PAGE event in OOPS ALV?
    See if this helps.
    Regards

  • How to get f4 help in alv grid in container-urgent

    hi,
    how to get f4 help in alv grid in container using abap objects
    ganesh

    Hi Ganesh,
    Did you have a look at sample report BCALV_TEST_GRID_F4_HELP ?
    Here is part of the header documentation:
    *& Report  BCALV_GRID_F4_HELP                                          *
    Purpose:
    ~~~~~~~~
    This report illustrates the use of f4-Help in an alv grid control.
    Background:
    ~~~~~~~~~~~
    There a two possibilities to implement an f4-Help in the alv grid
    control: one can either use standard f4-help or write one by Hand.
    For the former there is nothing to do at all. This report shows how
    to implement user-defined f4-help.
    I am sure you will find within this report the solution you are looking for.
    Reward points if this Helps.
    Manish

Maybe you are looking for

  • GL Data not available on report

    Hi All, I have a report which has been working fine. The report was based on cost for controlling cube which is based of WBS elements(cost). Now the report has been added with a column which gets its data from GL cube. I have added the 2 cubes in a m

  • MacBook doesn't detect music cd or open iTunes

    I have tried unsuccessfully to put new music onto my iTunes. When I insert a CD nothing happens. I have gone into System Preferences and it has IGNORE when you insert a music CD. I keep changing it back to open iTunes,but it keeps reverting back to I

  • Display all to a monitor with an ipad1?

    Hi how can I display everything from my ipad1 to a monitor?

  • Resetting Macbook to out of the box settings

    Hi, Can anyone tell me if its possible to reset my Macbook without having to run the install CD? In other words I am selling it but want to upgrade it to 10.5 but I want to set it back to the out-of-the box settings... I hope I am being clear? Thanks

  • Dwarf Fortress Wine Issue

    It's been a while since I brought this up, but I'm still having this issue. Basically the issue comes down to some glib conflict with dwarf-fortress that I have had a good deal of trouble tracking down. Here's the error trace: (dwarfort.exe:10401): G