Split  alv to 3

Hi all.
I have a screen splited to 2.
I would like to split it to 3 - top, middle & bottom.
My code is:
* Creating Custom Container
  IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
      EXPORTING
        container_name = g_custom_container_name.
  ENDIF.
* Creating Split Object
  IF g_split IS INITIAL.
    CREATE OBJECT g_split
             EXPORTING parent = g_custom_container
             orientation       =
                    cl_gui_easy_splitter_container=>orientation_vertical
             sash_position = 30
             with_border   = 1.
  ENDIF.
* Creating ALV instances
  IF grid1 IS INITIAL.
    CREATE OBJECT grid1
      EXPORTING
        i_parent = g_split->top_left_container.
* Exclude functions
    PERFORM exclude_tb_functions CHANGING lt_exclude.
* Creating and Registering Handler Object
    CREATE OBJECT g_event_handler.
    SET HANDLER g_event_handler->handle_toolbar      FOR grid1.
    SET HANDLER g_event_handler->handle_double_click FOR grid1.
    SET HANDLER g_event_handler->handle_user_command FOR grid1.
* Fill Field-Catalogs
    PERFORM field_catalog01.
* Set Layout
    PERFORM layout1.
    SORT gt_order BY aufnr.
* Display
    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
        is_layout            = gs_layout1
        i_save               = 'A'
        i_default            = 'X'
        is_variant           = g_variant
        it_toolbar_excluding = lt_exclude
      CHANGING
        it_outtab            = gt_order[]
        it_fieldcatalog      = gt_fc1[].
  ELSE.
    CALL METHOD grid1->refresh_table_display.
  ENDIF.
After a double-click I'm activating the following:
  IF grid2 IS INITIAL.
    CREATE OBJECT grid2
        EXPORTING
          i_parent = g_split->bottom_right_container.
* Fill Field-Catalog
    PERFORM field_catalog02.
* Set Layout
    PERFORM layout2.
*    SORT gt_res BY rsnum rspos.
    IF rb_comp EQ gc_true.
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout2
          i_save          = 'A'
        CHANGING
          it_outtab       = gt_res[]
          it_fieldcatalog = gt_fc2[].
    ELSE.
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout2
          i_save          = 'A'
        CHANGING
          it_outtab       = gt_res_conf[]
          it_fieldcatalog = gt_fc2[].
    ENDIF.
  ELSE.
    CALL METHOD grid2->refresh_table_display.
  ENDIF.
How can I add the third part ???
When I added it it's being displayed on the second, which means that the problem is with my container's & split's definition.
Thanks in advance,
Rebeka
Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 11:19 AM

Hello Rebeka
If you want to have top/middle/bottom control then create a single splitter container having a single column with three rows. Using the method GET_CONTAINER you retrieve the container instances for each control.
For a sample report have a look at ZUS_SDN_TWO_ALV_GRIDS in thread
alv
Regards
  Uwe

Similar Messages

  • Split ALV interms of a field.

    Hi ..
    How can I split ALV into many fields , according to the a field which can be change dynamically .If necessay to define clearly , my purpose is to show other columns according to different bukrs . For example in selection screen bukrs is selected 1000 but also true datas have for 1100 , I  want to open a split for 1100 or what ever else .
    Thanks in advance.

    Hi Yusuf
    Use two different intenal tables,
    1) for Bukrs
    SELECT * FROM bsid INTO TABLE wt_bsid
    WHERE bukrs EQ p_bukrs
    AND kunnr IN s_kunnr
    AND budat IN s_budat
    AND bldat IN s_bldat
    AND umskz EQ ' '
    AND blart IN s_blart
    AND waers IN s_waers.
    <b>The below query will give you the rest of the data</b>
    2) data other than p_bukrs
    SELECT * FROM bsid INTO TABLE wt_bsid_others
    WHERE bukrs NE p_bukrs
    AND kunnr IN s_kunnr
    AND budat IN s_budat
    AND bldat IN s_bldat
    AND umskz EQ ' '
    AND blart IN s_blart
    AND waers IN s_waers.
    What you could do is use a splitter screen display two ALV grid.
    Refer this for the code
    Two ALV grid in same report output
    Regards
    Kathirvel
    Message was edited by:
            Kathirvel Balakrishnan

  • Adding header in split alv using SALV

    Hello Champs,
    I have a requirement to display 6 diff reports in a screen. I have achieved it by using SALV(Split Container). Now I need to add header to each ALV report. The normal way of adding header in SALV doesnt work in the split ALV.
    Can someone help me with this.
    Thanks,
    Greg

    Hi, im experiencing the same situation right now, have you solved the problem? any inputs would be appreciated. thanks!

  • How to identify which ALV triggered event in split ALV

    Hi all,
    I'm using a split ALV like this:
    CREATE OBJECT ob_custom
      EXPORTING
        container_name = 'CONTAINER'.
    CREATE OBJECT ob_split1
      EXPORTING
        parent      = ob_custom
        orientation = cl_gui_easy_splitter_container=>orientation_vertical.
    CREATE OBJECT ob_grid1
      EXPORTING
        i_parent = ob_split1->top_left_container.
    CREATE OBJECT ob_grid2
      EXPORTING
        i_parent = ob_split1->bottom_right_container.
    I want to trigger double_click event:
    CREATE OBJECT ob_event.
      SET HANDLER ob_event->handle_double_click FOR ob_grid1.
      SET HANDLER ob_event->handle_double_click FOR ob_grid2.
    The problem is I don't know how to identify in which ALV the user double_clicked.
    Is there solution?
    Thanks in advance

    The trick is (just to help others):
    CLASS lcl_event_receiver1 DEFINITION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver1 IMPLEMENTATION.
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver2 DEFINITION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver2 IMPLEMENTATION.
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    and for data declaration:
    DATA: ob_event1  TYPE REF TO lcl_event_receiver1,
          ob_event2  TYPE REF TO lcl_event_receiver2.
    and then:
    CREATE OBJECT ob_event1.
    SET HANDLER ob_event1->handle_double_click FOR ob_grid1.
    CREATE OBJECT ob_event2.
    SET HANDLER ob_event1->handle_double_click FOR ob_grid2.
    Thanks a lot kiran kumar!
    Edited by: orgasmics on May 11, 2010 1:56 PM

  • SPLIT ALV Output-Line

    Hi,
    is it possible to split a Line in REUSE_ALV_LIST_DISPLAY?
    Example Normal:
    Line 1:  MATNR MAKTX ZEINR ...
    I want to have:
    Line 1:  MATNR MAKTX
    Line 2:        ZEINR
    I don't want to use a Hierachie
    thanks for help
    Regards, Dieter

    Hi,
    you can try with the Hierarchial alv list using the Fm <b>REUSE_ALV_HIERSEQ_LIST_DISPLAY</b>, also try to have a look in the Demo program <b>BALVHD01</b>.
    Regards
    vijay

  • Classes to split ALV in OO

    Hi All,
    I am using OO to display my ALV, what is needed to have a split on the ALV and display some data in the top half.
    Here is my code:
    TRY.
          cl_salv_table=>factory(
            IMPORTING r_salv_table = gr_alv
            CHANGING  t_table      = gt_rpt_details ).
          PERFORM f_set_header.
          PERFORM f_display_settings.
          gr_alv->set_screen_status(
          pfstatus = 'ZSTANDARD'
          report = sy-repid
          set_functions = gr_alv->c_functions_all ). "set all basic ALV funtions
          gr_events = gr_alv->get_event( ).
          "create layout object
          CREATE OBJECT gr_layout.
          lr_columns = gr_alv->get_columns( ).
          lr_columns->set_optimize( 'X' ).
          lr_columns->set_headers_visible( 'X' ).
    *   get layout object
          lo_layout = gr_alv->get_layout( ).
    *   set Layout save restriction
    *   1. Set Layout Key .. Unique key identifies the Differenet ALVs
          ls_key-report = sy-repid.
          lo_layout->set_key( ls_key ).
    *   2. Remove Save layout the restriction.
          lo_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
          lo_layout->set_default( abap_true ).
    *   set initial Layout
          "lf_variant = 'Z/ZTEST'.
          "lo_layout->set_initial_layout( lf_variant ).
          CREATE OBJECT event_handler.
          SET HANDLER event_handler->on_user_command FOR gr_events.
          gr_functions = gr_alv->get_functions( ).
          gr_functions->set_all('X').
          gr_functions->set_group_filter( value = if_salv_c_bool_sap=>false ).
    *       Set print preview
          gr_functions->set_print_preview( ).
          gr_alv->get_display_settings( ).
          gr_alv->display( ).
        CATCH cx_salv_msg.
          MESSAGE 'ALV Display Not possible'(w02) TYPE 'I' DISPLAY LIKE 'E'.
      ENDTRY.

    In order to split the ALV you can use the below code for your reference
    data : lr_custom_container type ref to cl_gui_custom_container,
           lr_event_receiver   type ref to lcl_event_receiver,
           lr_splitter         type ref to cl_gui_splitter_container,
           lr_parent_top       type ref to cl_gui_container,
           lr_parent_grid      type ref to cl_gui_container,
           lr_dyndoc_id        type ref to cl_dd_document,
           lr_display          type ref to cl_gui_alv_grid.
    if lr_custom_container is initial.
        v_container_name = " Container name which you defined in Screen
        create object lr_custom_container
          exporting
            container_name              = v_container_name
          exceptions
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
        if sy-subrc <> 0.
          message i081 display like c_e.
          "Unknown Error Occured While Displaying
          leave to screen 0.
        endif.
    *Split the container into two parts
        create object lr_splitter
          exporting
            parent            = lr_custom_container
            rows              = 2
            columns           = 1
          exceptions
            cntl_error        = 1
            cntl_system_error = 2
            others            = 3.
        if sy-subrc <> 0.
          message i081 display like c_e.
          "Unknown Error Occured While Displaying
          leave to screen 0.
        endif.
    *Get the upper part of the container into V_PARENT_TOP
        call method lr_splitter->get_container
          exporting
            row       = 1
            column    = 1
          receiving
            container = lr_parent_top.
    *Get the lower part of the container into V_PARENT_GRID
        call method lr_splitter->get_container
          exporting
            row       = 2
            column    = 1
          receiving
            container = lr_parent_grid.
    *Set the height of the top part of the container
        call method lr_splitter->set_row_height
          exporting
            id                = 1
            height            = 28
          exceptions
            cntl_error        = 1
            cntl_system_error = 2
            others            = 3.
        if sy-subrc <> 0.
          message i081 display like c_e.
          "Unknown Error Occured While Displaying
          leave to screen 0.
        endif.
    *Create a instance of cl_gui_alv_grid
        create object lr_display
          exporting
            i_parent          = lr_parent_grid
          exceptions
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            others            = 5.
        if sy-subrc <> 0.
          message i081 display like c_e.
          "Unknown Error Occured While Displaying
          leave to screen 0.
        endif.

  • Split ALV Column heading into two

    Hello All,
    I have a ALV Column Header - ALV LIST - SAP 46C.
    Material   |  Info Type |  Quantity |  Price etc..
    Due to space contraints and other reason client needs to split the Info type column into two.
    Material   |  Info  |  Quantity |  Price etc..
               | Type   |
    The data records should not have any additional blank lines.
    How to achieve this?
    Thanks,

    You have to assign X to layout property no_colhead.
    Then write your heading using write statements.
    Here is the exact example you are looking for [Create Multiple Lines Header In ALV List Report|http://www.freesaptutorial.com/create-multiple-lines-header-in-alv-list-report/]

  • ALV Report to have two different Reports

    Hi All,
    I have a need to display two different reports for the same set of data selections, (Successful data and Error Data) in a Single ALV Layout using a Application tool bar Button. Does anyone have a sample code for this kind of requirement. Preferably using Objects.
    Also, how can we check if an object is already created? In other words, how to check for a null reference?
    Thanks in advance.
    Jr.

    Sample code for split alv using OOABAP.
    this would help you in ur requirement.
    go through this program where the screen is divided in two for two alv in different containers.
    DATA: save_ok LIKE sy-ucomm,
          g_container TYPE scrfname VALUE 'CC1',
          g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          g_max TYPE i VALUE 100.
    declarations for top of page event
    Data:  gv_c_split type ref to cl_gui_splitter_container,
           gv_c_ptv type ref to cl_gui_container,
           gv_alv_ptv type ref to cl_gui_alv_grid,
           o_dd_doc TYPE REF TO cl_dd_document,
           text TYPE sdydo_text_element,
           o_split type ref to cl_gui_easy_splitter_container,
           o_top type ref to cl_gui_container,
           o_bot type ref to cl_gui_container,
           gv_c_vp type ref to cl_gui_container.
    end of declaration for top of page.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    *class lcl_application_dc definition deferred.
    DATA: o_event_receiver TYPE REF TO lcl_event_receiver.
         g_dc type ref to lcl_application_dc.
    DATA: gt_outtab TYPE TABLE OF sbook.
          CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
                   IMPORTING e_fieldname
                             es_row_no
                             er_event_data
                             et_bad_cells
                             e_display,
                handle_top_of_page FOR EVENT top_of_page OF cl_gui_alv_grid
                   IMPORTING e_dyndoc_id.
        METHODS: reset.
        METHODS: show_f4.
      PRIVATE SECTION.
    attributes for creating an own F4-Help
    (using a second ALV Grid Control
        DATA: f4_grid TYPE REF TO cl_gui_alv_grid,
              f4_custom_container TYPE REF TO cl_gui_custom_container.
        TYPES: BEGIN OF ty_f4.
        TYPES: value TYPE s_class.
        TYPES: descr(20) TYPE c.
        TYPES: END OF ty_f4.
        DATA: f4_itab TYPE TABLE OF ty_f4.
        DATA: f4_fieldcatalog TYPE lvc_t_fcat.
    attributes to store event parameters
    (after the CALL SCREEN command, the event parameters
    are not accessible)
        TYPES: BEGIN OF onf4_event_parameters_type.
        TYPES: c_fieldname     TYPE lvc_fname.
        TYPES: cs_row_no       TYPE lvc_s_roid.
        TYPES: cr_event_data   TYPE REF TO cl_alv_event_data.
        TYPES: ct_bad_cells    TYPE lvc_t_modi.
        TYPES: c_display       TYPE char01.
        TYPES: END OF onf4_event_parameters_type.
        DATA: f4_params TYPE onf4_event_parameters_type.
    Methods to create own F4-Help
    (This is done using a second ALV Grid Control)
        METHODS: init_f4.
        METHODS: build_fieldcatalog.
        METHODS: fill_f4_itab .
        METHODS: on_double_click FOR EVENT double_click OF cl_gui_alv_grid
                        IMPORTING es_row_no.
    ENDCLASS.                    "lcl_application_f4 DEFINITION
          CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    *§2. Implement an event handler method for event ONF4.
      METHOD handle_f4.
    Save event parameter as global attributes of this class
    (maybe solved differently if you use a function module!)
        f4_params-c_fieldname = e_fieldname.
        f4_params-cs_row_no = es_row_no.
        f4_params-cr_event_data = er_event_data.
        f4_params-ct_bad_cells = et_bad_cells.
        f4_params-c_display = e_display.
    *§3. Call your own f4 help. To customize your popup check
       first if the cell is ready for input (event parameter E_DISPLAY).
    (parameter E_DISPLAY is checked later in method on_double_click)
    (Probably, you would call a function module at this point,
    pass the needed event parameter and call the popup screen
    within that function module. This is not done in this example
    to avoid scattering its code).
        CALL SCREEN 101 STARTING AT 10 10.
    *§7. Inform the ALV Grid Control that an own f4 help has been processed
       to suppress the standard f4 help.
        er_event_data->m_event_handled = 'X'.
      ENDMETHOD.                                                "on_f4
      METHOD show_f4.
       DATA: ls_outtab TYPE sbook.
    initialize own f4 help if needed
        IF f4_custom_container IS INITIAL.
          CALL METHOD init_f4.
        ENDIF.
        CALL METHOD fill_f4_itab.
    refresh list of values in f4 help and show it
        CALL METHOD f4_grid->refresh_table_display.
    CAUTION: Do not use method REFRESH_TABLE_DISPLAY for
    your editable ALV Grid instances while handling events
    DATA_CHANGED or ONf4. You would overwrite intermediate
    values of your output table on frontend.
    'f4_grid' is a non-editable ALV Grid Control for the
    application specific F4-Help. Therefore, calling
    REFRESH_TABLE_DISPLAY for this instance has no
    negative effect.
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.                                                "show_f4
      METHOD init_f4.
        DATA: ls_f4_layout TYPE lvc_s_layo.
    build fieldcatalog entries for f4
        CALL METHOD build_fieldcatalog.
    create controls
        CREATE OBJECT f4_custom_container
                  EXPORTING container_name = 'CC_ONF4'.
        CREATE OBJECT f4_grid
                  EXPORTING i_parent = f4_custom_container.
    hide toolbar
        ls_f4_layout-no_toolbar = 'X'.
        CALL METHOD f4_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ls_f4_layout
          CHANGING
            it_fieldcatalog = f4_fieldcatalog
            it_outtab       = f4_itab.
    register event double click on backend
        SET HANDLER me->on_double_click FOR f4_grid.
    flush since 'ls_layout' is local!
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.                                                "init_f4
      METHOD fill_f4_itab.
        DATA ls_f4_itab TYPE ty_f4.
    Delete all entries in f4_itab to determine
    offered values dynamically
        CLEAR f4_itab[].
        ls_f4_itab-value = 'C'.
        ls_f4_itab-descr = text-t03. "Business Class
        APPEND ls_f4_itab TO f4_itab.
        ls_f4_itab-value = 'Y'.
        ls_f4_itab-descr = text-t04. "Economie Class
        APPEND ls_f4_itab TO f4_itab.
        ls_f4_itab-value = 'F'.
        ls_f4_itab-descr = text-t05. "First Class
        APPEND ls_f4_itab TO f4_itab.
      ENDMETHOD.                    "fill_f4_itab
      METHOD build_fieldcatalog.
        DATA: ls_fcat TYPE lvc_s_fcat.
        CLEAR ls_fcat.
        ls_fcat-fieldname = 'VALUE'.
        ls_fcat-coltext = text-t02.
       ls_fcat-inttype = 'S_CLASS'.
        ls_fcat-outputlen = 5.
        APPEND ls_fcat TO f4_fieldcatalog.
        CLEAR ls_fcat.
        ls_fcat-fieldname = 'DESCR'.
        ls_fcat-coltext = text-t01.
        ls_fcat-inttype = 'C'.
        ls_fcat-outputlen = 20.
        APPEND ls_fcat TO f4_fieldcatalog.
      ENDMETHOD.                    "build_fieldcatalog
      METHOD on_double_click.
    *§5. If not already caught by your own f4 help, check whether
       the triggered cell was ready for input by using E_DISPLAY
       and if not, exit.
        IF f4_params-c_display EQ 'X'.
          LEAVE SCREEN.
        ENDIF.
    *§6. After the user selected a value, pass it to the ALV Grid Control:
    *§  6a. Define a field symbol of type: LVC_T_MODI and a structure of
          type LVC_S_MODI to pass the value later on.
        FIELD-SYMBOLS  TYPE lvc_t_modi.
        DATA: ls_modi TYPE lvc_s_modi,
              ls_f4_itab TYPE ty_f4.
    *§  6b. Dereference attribute M_DATA into your field symbol and add
          the selected value to the table to which this symbol points to.
        ASSIGN f4_params-cr_event_data->m_data->* TO .
        LEAVE TO SCREEN 0.
      ENDMETHOD.                    "on_double_click
      METHOD reset.
        FIELD-SYMBOLS display_document
                 EXPORTING parent = o_top.
      ENDMETHOD.                    "handle_top_of_page
    ENDCLASS.                    "lcl_application_f4 IMPLEMENTATION
    END-OF-SELECTION.
      CALL SCREEN 100.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF g_custom_container IS INITIAL.
        PERFORM create_and_init_alv CHANGING gt_outtab[]
                                             gt_fieldcat.
      ENDIF.
    ENDMODULE.                    "pbo OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      save_ok = sy-ucomm.
      CLEAR sy-ucomm.
      CASE save_ok.
        WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
          PERFORM exit_program.
        WHEN 'SWITCH'.
          PERFORM switch_edit_mode.
        WHEN OTHERS.
        do nothing
      ENDCASE.
    ENDMODULE.                    "pai INPUT
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      LEAVE PROGRAM.
    ENDFORM.                    "exit_program
    *&      Form  build_fieldcat
          text
         -->PT_FIELDCAT  text
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'SBOOK'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
    Exchange smoker field with invoice field - just to
    make the dependance between SMOKER and CLASS more transparent
    (Smoking is only allowed in the first class).
        IF ls_fcat-fieldname EQ 'SMOKER'.
          ls_fcat-col_pos = 11.
          ls_fcat-outputlen = 10.
          ls_fcat-edit = 'X'.
    Field 'checktable' is set to avoid shortdumps that are caused
    by inconsistend data in check tables. You may comment this out
    when the test data of the flight model is consistent in your system.
          ls_fcat-checktable = '!'.        "do not check foreign keys
          MODIFY pt_fieldcat FROM ls_fcat.
        ELSEIF ls_fcat-fieldname EQ 'INVOICE'.
          ls_fcat-col_pos = 7.
          MODIFY pt_fieldcat FROM ls_fcat.
        ELSEIF    ls_fcat-fieldname EQ 'CLASS'.
          ls_fcat-edit = 'X'.
          ls_fcat-outputlen = 5.
          ls_fcat-checktable = '!'.        "do not check foreign keys
          MODIFY pt_fieldcat FROM ls_fcat.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  create_and_init_alv
          text
         -->PT_OUTTAB    text
         -->PT_FIELDCAT  text
    FORM create_and_init_alv CHANGING pt_outtab TYPE STANDARD TABLE
                                      pt_fieldcat TYPE lvc_t_fcat.
      DATA: lt_exclude TYPE ui_functions,
            ls_layout TYPE lvc_s_layo.
      CREATE OBJECT g_custom_container
              EXPORTING container_name = g_container.
    CREATE OBJECT g_grid
            EXPORTING i_parent = g_custom_container.
      CREATE OBJECT gv_c_split
         EXPORTING
          link_dynnr        = lv_dynnr
          link_repid        = lv_repid
          parent            = g_custom_container
          rows              = 2
          columns           = 1
         EXCEPTIONS
           cntl_error        = 1
           cntl_system_error = 2
           others            = 3    .
      CALL METHOD gv_c_split->set_border
       EXPORTING
         border            = space.
      CALL METHOD gv_c_split->get_container
         EXPORTING
           row       = 1
           column    = 1
         RECEIVING
           container = gv_c_ptv.
      CALL METHOD gv_c_split->set_row_height
        EXPORTING
          id                = 1
          height            = 20
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 6 .
      CALL METHOD gv_c_split->get_container
         EXPORTING
           row       = 2
           column    = 1
         RECEIVING
           container = gv_c_vp .
      CALL METHOD gv_c_split->set_row_height
        EXPORTING
          id                = 2
          height            = 10
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3 .
       CREATE OBJECT o_split
         EXPORTING
          parent            = gv_c_ptv
          with_border       = 1
         EXCEPTIONS
           cntl_error        = 1
           cntl_system_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.
    o_top = o_split->top_left_container.
    o_bot = o_split->bottom_right_container.
    CREATE OBJECT gv_alv_ptv
         EXPORTING
           i_parent          = o_bot
         EXCEPTIONS
           error_cntl_create = 1
           error_cntl_init   = 2
           error_cntl_link   = 3
           error_dp_create   = 4
           others            = 5    .
    CREATE OBJECT g_grid
            EXPORTING
              i_parent          = gv_c_vp
            EXCEPTIONS
              error_cntl_create = 1
              error_cntl_init   = 2
              error_cntl_link   = 3
              error_dp_create   = 4
              others            = 5    .
      PERFORM build_fieldcat CHANGING pt_fieldcat.
    Optionally restrict generic functions to 'change only'.
      (The user shall not be able to add new lines).
      PERFORM exclude_tb_functions CHANGING lt_exclude.
      PERFORM build_data CHANGING pt_outtab.
      ls_layout-grid_title = 'F4 help implemented for field CLASS'.
      CREATE OBJECT o_event_receiver.
      SET HANDLER o_event_receiver->handle_top_of_page FOR gv_alv_ptv.
      SET HANDLER o_event_receiver->handle_top_of_page FOR g_grid.
      CREATE OBJECT o_dd_doc EXPORTING style = 'ALV_GRID'
                                       no_margins = 'X'.
      CALL METHOD gv_alv_ptv->set_table_for_first_display
       EXPORTING
         is_layout                    = ls_layout
      CHANGING
        it_outtab                     = pt_outtab[]
        it_fieldcatalog               = pt_fieldcat
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          it_toolbar_excluding = lt_exclude
          is_layout            = ls_layout
        CHANGING
          it_fieldcatalog      = pt_fieldcat
          it_outtab            = pt_outtab[].
      CALL METHOD gv_alv_ptv->list_processing_events
        EXPORTING
          i_event_name      = 'TOP_OF_PAGE'
           i_dyndoc_id       = o_dd_doc.
    register f4 for field CLASS
      PERFORM register_events.
    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.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_data
          text
    -->  p1        text
    <--  p2        text
    FORM build_data CHANGING pt_outtab TYPE STANDARD TABLE.
      DATA: ls_sbook TYPE sbook,
            l_index TYPE i.
      SELECT * FROM sbook INTO TABLE gt_outtab UP TO g_max ROWS.
      IF sy-subrc NE 0.
        PERFORM generate_entries CHANGING pt_outtab.
      ENDIF.
      LOOP AT pt_outtab INTO ls_sbook.
        l_index = sy-tabix.
        CLEAR ls_sbook-class.
    Alternate between smoker and non smoker to make
    it more obvious what this example is about
        l_index = l_index MOD 2.
        IF l_index EQ 1.
          ls_sbook-smoker = 'X'.
        ELSE.
          ls_sbook-smoker = ' '.
        ENDIF.
        MODIFY pt_outtab FROM ls_sbook.
      ENDLOOP.
    ENDFORM.                               " build_data
    *&      Form  generate_entries
          text
         -->PT_SBOOK   text
    FORM generate_entries CHANGING pt_sbook TYPE STANDARD TABLE.
      DATA: ls_sbook TYPE sbook,
            l_month(2) TYPE c,
            l_day(2) TYPE c,
            l_date(8) TYPE c,
         l_prebookid TYPE i.
      ls_sbook-carrid = 'LH'.
      ls_sbook-connid = '0400'.
      ls_sbook-forcurkey = 'DEM'.
      ls_sbook-loccurkey = 'USD'.
      ls_sbook-custtype = 'B'.
      DO 110 TIMES.
        l_prebookid = sy-index.
        ls_sbook-forcuram = sy-index * 10.
        ls_sbook-loccuram = ls_sbook-loccuram * 2.
        ls_sbook-customid = sy-index.
        ls_sbook-counter = 18.
        ls_sbook-agencynum = 11.
        l_month = sy-index / 10 + 1.
        DO 2 TIMES.
          l_day = 3 + l_month + sy-index * 2.
          l_date+0(4) = '2000'.
          l_date+4(2) = l_month.
          l_date+6(2) = l_day.
          ls_sbook-fldate = l_date.
          SUBTRACT 3 FROM l_day.
          ls_sbook-order_date+0(6) = l_date+0(6).
          ls_sbook-order_date+6(2) = l_day.
          ls_sbook-bookid = l_prebookid * 2 + sy-index.
          IF sy-index EQ 1.
            ls_sbook-smoker = 'X'.
          ELSE.
            ls_sbook-smoker = space.
          ENDIF.
          ls_sbook-luggweight = l_prebookid * 10.
          IF ls_sbook-luggweight GE 1000.
            ls_sbook-wunit = 'G'.
            ls_sbook-class = 'C'.
          ELSE.
            ls_sbook-wunit = 'KG'.
            ls_sbook-class = 'Y'.
          ENDIF.
          IF ls_sbook-bookid > 40 AND ls_sbook-wunit EQ 'KG'.
            ls_sbook-invoice = 'X'.
          ENDIF.
          IF ls_sbook-bookid EQ 2.
            ls_sbook-cancelled = 'X'.
            ls_sbook-class = 'F'.
          ENDIF.
          APPEND ls_sbook TO pt_sbook.
        ENDDO.
      ENDDO.
    ENDFORM.                               " generate_entries
    *&      Form  register_events
          text
    FORM register_events.
    *§1. Register event ONF4 at frontend using method
       register_f4_for_fields. For this purpose, you pass a table
       with all fields, for which you want to implement your own
       f4 help.
    remark: If you want to use an own f4 help for fields where
            no standard f4 help exists set field F4AVAILABL for
            this field in the fieldcatalog.
      DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
      CLEAR lt_f4.
      lt_f4-fieldname = 'CLASS'.
    If you would like to deregister the field again,
    pass value SPACE with field 'register'.
      lt_f4-register = 'X'.
    *§  1b. If the value range in your f4 help depends on other
          values of cells that are input enabled, set the
          GETBEFORE parameter.
    The consequence is that the ALV Grid Control raises
    event DATA_CHANGED before the f4 help is called to
    check values that the f4 help depends on.
      lt_f4-getbefore = 'X'.
    The next parameter is used to change values after onf4 has
    been processed. The ALV Grid Control will raise
    event DATA_CHANGED afterwards, if you set it.
      lt_f4-chngeafter = space.
      INSERT TABLE lt_f4.
      CALL METHOD g_grid->register_f4_for_fields
        EXPORTING
          it_f4 = lt_f4[].
    register events for abap objects (backend)
      SET HANDLER o_event_receiver->handle_f4 FOR g_grid.
    ENDFORM.                    " register_events
    MODULE status_0101 OUTPUT
    MODULE status_0101 OUTPUT.
      SET PF-STATUS 'POPUP'.
      SET TITLEBAR 'POPUP'.
      CALL METHOD o_event_receiver->show_f4.
    ENDMODULE.                 " STATUS_0101  OUTPUT
    *&      Module  USER_COMMAND_0101  INPUT
          text
    MODULE user_command_0101 INPUT.
      PERFORM user_command.
    ENDMODULE.                 " USER_COMMAND_0101  INPUT
    *&      Form  user_command
          text
    FORM user_command.
      DATA: save_ok TYPE sy-ucomm.
      save_ok = sy-ucomm.
      CLEAR sy-ucomm.
      CASE save_ok.
        WHEN 'CANCEL'.
          CALL METHOD o_event_receiver->reset.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  switch_edit_mode
          text
    FORM switch_edit_mode.
      IF g_grid->is_ready_for_input( ) EQ 0.
    set edit enabled cells ready for input
        CALL METHOD g_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = 1.
      ELSE.
    lock edit enabled cells against input
        CALL METHOD g_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = 0.
      ENDIF.
    ENDFORM.                    "switch_edit_mode

  • History list in an ALV editable cell

    Hello
    I am trying to have a history list in my ALV editable cells as per described in the ALV Grid SAP documentation but I am unable to do so.  The documentation indicates that u201Cif the cursor is on the first item cell you can use Backspace to call up a history listu201D.
    I created a screen containing regular standard fields in the upper portion of the screen and I added an ALV grid (split into 3 sections) in the low part of the screen.  The ALV contain several editable cells.  The history list works very well for the regular fields on the screen but I cannot get the history list working for any of the editable cells in the ALV.
    I have defined the field catalog for the editable cells as follows (including the AUTO_VALUE field):
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'SERNR'.
      wa_fieldcat-reptext   = text-002.
      wa_fieldcat-edit      = 'X'.
      wa_fieldcat-auto_value = 'X'.
      wa_fieldcat-checkbox  = ' '.
      wa_fieldcat-hotspot   = ' ' .
      wa_fieldcat-dd_outlen = ' '.
      wa_fieldcat-icon      = ' '.
      wa_fieldcat-no_zero   = 'X'.           
      APPEND wa_fieldcat TO it_fieldcat_notif.
    I then generate the 3 splitted ALV as follows:
      zlayout_header-grid_title = 'Repair Order and Delivery'.
      zlayout_header-no_toolbar = 'X'.
      zlayout_header-stylefname = 'CELLTAB'.
      CALL METHOD ob_grid1->set_table_for_first_display
        EXPORTING
          is_variant       =  ls_vari
          i_default        = ' '
          i_save           = 'A'
          is_layout        = zlayout_header
        CHANGING
          it_fieldcatalog  = it_fieldcat_repair
          it_outtab        = t_repair[].
      zlayout_header-grid_title = 'Notification'.
      zlayout_header-no_toolbar = 'X'.
      zlayout_header-stylefname = 'CELLTAB'.
      CALL METHOD ob_grid2->set_table_for_first_display
        EXPORTING
          is_variant       =  ls_vari
          i_default        = ' '
          i_save           = 'A'
          is_layout       = zlayout_header
        CHANGING
          it_fieldcatalog = it_fieldcat_notif
          it_outtab       = t_notif[].
      zlayout_header-grid_title = 'Service Order'.
      zlayout_header-no_toolbar = 'X'.
      zlayout_header-stylefname = 'CELLTAB'.
      CALL METHOD ob_grid3->set_table_for_first_display
        EXPORTING
          is_variant       =  ls_vari
          i_default        = ' '
          i_save           = 'A'
          is_layout       = zlayout_header
        CHANGING
          it_fieldcatalog = it_fieldcat_service
          it_outtab       = t_service[].
    I searched forums and OSS notes but I could not find any more information (except for the ALV Grid u2013 SAP Documentation) about the history list for editable ALV cells.  Currently, our application utilizes table controls in the lower part of the screen and the history list works well for the cells in the table control.  However, when I replace the table control for an ALV grid, I can no longer use the history list for those cells.
    Any help would be appreciated.

    Looks like the 2006 OSS note 825068 indicates the history list function is not supported for ALV grid.

  • How can we split the grid display in alv reports.

    hi everyone.i am trying to get the display of two reports in a single one using split screens.i had written a report for vendor balance.one for open and one for cleared items.how can i combine these two reports.
    the field catalog was same for these two.
    can anyone suggest me suitable way to perform.

    HI,
           You can  also try ALV Blocked display.
    Pls Check following program
    BCALV_TEST_BLOCK_LIST.
    FM used are
    call function 'REUSE_ALV_BLOCK_LIST_INIT'
    exporting
    i_callback_program = sy-repid.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = it_layout
    it_fieldcat = fc
    i_tabname = 'IT_VBRK1'
    it_events = it_event
    tables
    t_outtab = it_vbrk1.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = it_layout
    it_fieldcat = fc1
    i_tabname = 'IT_VBRK2'
    it_events = it_event
    tables
    t_outtab = it_vbrk2.
    call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    form top_of_page1.
    format color col_positive.
    write: / 'FIRST BLOCK'.
    endform.

  • Avoid splitting of columns ALV report while download output to Excel sheet

    Hi friends,
                  I have 170 columns in my ALV report
    while downloading the report to Excel sheet
    the column descriptions and values are splitting in two lines.
    How can i avoid the problem.
    before calling REUSE_ALV_GRID_DISPLAY function module in my code
    for the Layout i assigned LS_LAYOUT-MAX_SIZE = 1023.
    but still the problem is not solved.
    Please help me in this Issue.
    Thanks in Advance,
    Ganesh

    Hi friends,
    I dont want to use and Keyboard shiftcntrl....
    or dont want to change any code in ALV report
    by simply assigning some value to any of the export parameter in ALV function module
    can we achieve the functionality
    Thanks in Advance,
    Ganesh

  • How to split a single column row  in alv report

    Hi All,
    I need to split a row of the particular coolumn in alv report.
    for example row size is 10 that should be split into 5 & 5.
    Thanks
    Ram

    Hi Ram,
    You can add one more column for that..
    while processing your internal table you can split the value for that column using offset..
    DATA :  FIELD_STR(10) TYPE C.
    VAR1 = FIELD_STR+0(5) .
    VAR2 = FIELD_STR+5(5) .
    Now you can print this both VAR1 and VAR2 in seperate column.
    Please search on SCN before posting any question..
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • ALV Output splitting out for every 60 lines if i run in background...

    Hello,
    I am running ALV report in background.Output is splitting out for every 60 lines.If i run report inforeground it is not happening.
    For exmaple...let us take there are 200 rows in output.for every 60 lines cloumn heading is printing.IF i download output into excel same for every 60 lines col headings are printing.issue is header should not print for every 60 lines...could you please let  me know is there settings to avoid this ...?Thanks in advance.
    Regards.
    Abshek

    Hi
    Its May be LINE SIZE OVERFLOW.
    Please Check SAP NOTE 1059001....
    This URL helps you
    http://help.sap.com/abapdocu_70/en/ABENPRINT.htm
    Regards
    Ajit

  • Alv output splitting into two rows when converting into excel sheet.

    Hi frends,
    I have alv report with 60 fields . The report output is coming currently .  But when i am exporting into excel sheet from the option local file--> speadsheet  each row is splitting into two rows including header in excel sheet.
    Please provide your valuable suggestions to avoid this.
    Regards,
    Ramu .
    Edited by: Ramu.K on Sep 8, 2009 5:59 PM

    Hi,
    Please use the grid option and with the Spreadsheet button (CntrShiftF7). Do  "Save as" and save it as excel. It should work.
    Regards,
    Pradyumna

  • ALV download to local file, splits line in two

    Dear Abapers,
    I have a quite wide ALV report, when downloading to local file, I get the "long" line splitted in 2 (in case of spreadsheet format) and in 3 in case of unconverted format.
    Is there a turn arround in order to have only one line?
    It's not an excel limitation, once there are enough columns to paste the "lower" part of the line on the right of the "upper" part.
    Thanks in advance.
    FLP

    Hi,
    I download the report, pressing the "Local File... (CtrlShiftF9) icon on the ALV, after I choose "Uncoverted" or "Spreadsheet" radio button. If by "Excel in place" you mean press the "Microsoft Excel" icon, for some stransge reason, on my pc and some other users this doesn works, nothing happens or a blank spreadsheet is opened, if you mean something else, plese revert, once I didn't understand it correctly.
    Thanks in advanve
    FLP

Maybe you are looking for

  • Upgraded to extreme and can no longer connect to xbox live

    My old airport express died so yesterday I bought an airport extreme to replace it. I had no problems setting it up, my powerbook and powermac connect to the internet just fine. My ps3, wii, and apple tv all connect fine. However I lost the ability t

  • Leading Zeros in Zip Code

    I frequently export address information from a database to a tab-delimited text file and then import it into Numbers. However, some zip codes have leading zeros (i.e., "00644"). When I import this file into Numbers the zip codes with leading zeros lo

  • Recalling my vi

    I am trying to create a vi that performs error checking on certain values. If the values are false I present a pop-up message asking the user to re-enter the values. How do I create this recursive function?

  • Can't send pictures. How do I fix this?

    None of my devices will send pictures via text or iMessage. I notice this is a problem mostly when I am at home using a secure Comcast wifi connection, could this have anything to do with this issue? Is there any way to fix this?

  • Tethered Shooting in LR3

    Where can I find a listing of the cameras LR3 supports for tethered shooting?  Wondering if my Nikon D700 is supported.