Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Split Screen ALV

marco_paroti
Explorer
5,892

Hi all,

I need help and a suggestion how to realize this:

|-----------------------------|
|                             |
|              TOP            |
|                             |
|-----------------------------|
|              |              |
|              |              |
|     LEFT     |   RIGHT      |
|              |              |
|              |              |
|-----------------------------|

I have found this coding, see below, but the result looks like this:

|-----------------------------|
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|--------------|              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|-----------------------------|

Which settings do I have to change in order to get the desired result?

Or do you have a more elegant solution?

Thank you so much for your help.

Best regards,

Marco

Coding:

*&---------------------------------------------------------------------*
*& Report Y_DEMO_6
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Y_DEMO_6.
*&---------------------------------------------------------------------*
*& Display Customer data in three ALV lists:
*& 1st ALV: Customers
*& 2nd ALV: Sales order of selected customer (double-click)
*& 3rd ALV: Positions   of selected sales order (double-click)
*&          Double-click on material -> display material (MM02)
*&---------------------------------------------------------------------*
*& NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
*& Flow logic of dynpro '0100':
*&
*&PROCESS BEFORE OUTPUT.
*&  MODULE STATUS_0100.
*&
*&PROCESS AFTER INPUT.
*&  MODULE USER_COMMAND_0100.
*&---------------------------------------------------------------------*


DATA:
  gd_okcode        TYPE ui_func,
*
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_splitter      TYPE REF TO cl_gui_splitter_container,
  go_splitter_2    TYPE REF TO cl_gui_splitter_container,
  go_cell_top      TYPE REF TO cl_gui_container,
  go_cell_bottom   TYPE REF TO cl_gui_container,
  go_cell_left     TYPE REF TO cl_gui_container,
  go_cell_right    TYPE REF TO cl_gui_container,
  go_grid1         TYPE REF TO cl_gui_alv_grid,
  go_grid2         TYPE REF TO cl_gui_alv_grid,
  go_grid3         TYPE REF TO cl_gui_alv_grid.


DATA:
  gt_knb1          TYPE STANDARD TABLE OF knb1,
  gt_vbak          TYPE STANDARD TABLE OF vbak,
  gt_vbap          TYPE STANDARD TABLE OF vbap.




PARAMETERS:
  p_bukrs          TYPE bukrs  DEFAULT '3110'.



*---------------------------------------------------------------------*
*       CLASS lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler DEFINITION.

  PUBLIC SECTION.
    CLASS-METHODS:
      handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
        IMPORTING
          e_row
          e_column
          es_row_no
          sender.  " sending control, i.e. ALV grid that raised event


ENDCLASS.                    "lcl_eventhandler DEFINITION



*---------------------------------------------------------------------*
*       CLASS lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.

  METHOD handle_double_click.
*   define local data
    DATA:
      ls_knb1      TYPE knb1,
      ls_vbak      TYPE vbak,
      ls_vbap      TYPE vbap.


*   Distinguish according to sending grid instance
    CASE sender.
      WHEN go_grid1.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).

        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
*              IS_ROW_ID    =
*              IS_COLUMN_ID =
            is_row_no    = es_row_no.


*         Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).


      WHEN go_grid2.
        READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
        CHECK ( ls_vbak-vbeln IS NOT INITIAL ).

        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
*              IS_ROW_ID    =
*              IS_COLUMN_ID =
            is_row_no    = es_row_no.

*         Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).



      WHEN go_grid3.
        READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
        CHECK ( ls_vbap-matnr IS NOT INITIAL ).

        SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
        CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.

      WHEN OTHERS.
        RETURN.
    ENDCASE.







  ENDMETHOD.                    "handle_double_click

ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION






START-OF-SELECTION.

  SELECT        * FROM  knb1 INTO TABLE gt_knb1
         WHERE  bukrs  = p_bukrs.


* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
      ratio                       = 90
    EXCEPTIONS
      OTHERS                      = 6.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



* Create splitter container
  CREATE OBJECT go_splitter
    EXPORTING
      parent            = go_docking
      rows              = 1
      columns           = 2
*      NO_AUTODEF_PROGID_DYNNR =
*      NAME              =
    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.

* Get cell container
  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = go_cell_left.

  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 1
      column    = 2
    RECEIVING
      container = go_cell_right.


* Create 2nd splitter container
  CREATE OBJECT go_splitter_2
    EXPORTING
      parent            = go_cell_left
      rows              = 2
      columns           = 1
*      NO_AUTODEF_PROGID_DYNNR =
*      NAME              =
    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.

* Get cell container
  CALL METHOD go_splitter_2->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = go_cell_top.
  CALL METHOD go_splitter_2->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = go_cell_left.


* Create ALV grids
  CREATE OBJECT go_grid1
    EXPORTING
      i_parent          = go_cell_top
    EXCEPTIONS
      OTHERS            = 5.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CREATE OBJECT go_grid2
    EXPORTING
      i_parent          = go_cell_left
    EXCEPTIONS
      OTHERS            = 5.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CREATE OBJECT go_grid3
    EXPORTING
      i_parent          = go_cell_right
    EXCEPTIONS
      OTHERS            = 5.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.





* Set event handler
  SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
  SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid2.
  SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid3.


* Display data
  CALL METHOD go_grid1->set_table_for_first_display
    EXPORTING
      i_structure_name = 'KNB1'
    CHANGING
      it_outtab        = gt_knb1
    EXCEPTIONS
      OTHERS           = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  REFRESH: gt_vbak.
  CALL METHOD go_grid2->set_table_for_first_display
    EXPORTING
      i_structure_name = 'VBAK'
    CHANGING
      it_outtab        = gt_vbak    " empty !!!
    EXCEPTIONS
      OTHERS           = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  REFRESH: gt_vbap.
  CALL METHOD go_grid3->set_table_for_first_display
    EXPORTING
      i_structure_name = 'VBAP'
    CHANGING
      it_outtab        = gt_vbap    " empty !!!
    EXCEPTIONS
      OTHERS           = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

* Link the docking container to the target dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


* NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
  CALL SCREEN '0100'.
* Flow logic of dynpro:
**
*PROCESS BEFORE OUTPUT.
*  MODULE STATUS_0100.
**
*PROCESS AFTER INPUT.
*  MODULE USER_COMMAND_0100.



END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.  " contains push button "ORDERS"
  SET TITLEBAR 'xxx'.


* Refresh display of detail ALV list
  CALL METHOD go_grid2->refresh_table_display
*    EXPORTING
*      IS_STABLE      =
*      I_SOFT_REFRESH =
    EXCEPTIONS
      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.


* Refresh display of detail ALV list
  CALL METHOD go_grid3->refresh_table_display
*    EXPORTING
*      IS_STABLE      =
*      I_SOFT_REFRESH =
    EXCEPTIONS
      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.

ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE gd_okcode.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.

*   User has pushed button "Display Orders"
    WHEN 'ORDERS'.
      PERFORM customer_show_orders.

    WHEN 'ORDER_DETAILS'.
      PERFORM order_show_details.

    WHEN OTHERS.
  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*
*&      Form  CUSTOMER_SHOW_ORDERS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM customer_show_orders .
* define local data
  DATA:
    ld_row      TYPE i,
    ls_knb1     TYPE knb1.

  CALL METHOD go_grid1->get_current_cell
    IMPORTING
      e_row = ld_row.

  READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
  CHECK ( syst-subrc = 0 ).

  SELECT        * FROM  vbak INTO TABLE gt_vbak
         WHERE  kunnr  = ls_knb1-kunnr.


  REFRESH: gt_vbap.




ENDFORM.                    " CUSTOMER_SHOW_ORDERS

*&---------------------------------------------------------------------*
*&      Form  ORDER_SHOW_DETAILS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM order_show_details .
* define local data
  DATA:
    ld_row      TYPE i,
    ls_vbak     TYPE vbak.

  CALL METHOD go_grid1->get_current_cell
    IMPORTING
      e_row = ld_row.

  READ TABLE gt_vbak INTO ls_vbak INDEX ld_row.
  CHECK ( syst-subrc = 0 ).

  SELECT        * FROM  vbap INTO TABLE gt_vbap
         WHERE  vbeln  = ls_vbak-vbeln.



ENDFORM.                    " ORDER_SHOW_DETAILS
7 REPLIES 7

MateuszAdamus
Active Contributor
3,821

Hello marco.paroti

You need to change the definition of the splitters, to have two rows and two columns in the second row. Not two columns and two rows in the first column.

* Create splitter container
  CREATE OBJECT go_splitter
    EXPORTING
      parent            = go_docking
      rows              = 2 " <-- modified
      columns           = 1 " <-- modified
*      NO_AUTODEF_PROGID_DYNNR =
*      NAME              =
    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.

* Get cell container
  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = go_cell_left.

  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 2  " <-- modified
      column    = 1  " <-- modified
    RECEIVING
      container = go_cell_right.

* Create 2nd splitter container
  CREATE OBJECT go_splitter_2
    EXPORTING
      parent            = go_cell_right " <-- modified
      rows              = 1  " <-- modified
      columns           = 2  " <-- modified
*      NO_AUTODEF_PROGID_DYNNR =
*      NAME              =
    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.

* Get cell container
  CALL METHOD go_splitter_2->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = go_cell_top.
  CALL METHOD go_splitter_2->get_container
    EXPORTING
      row       = 1 " <-- modified
      column    = 2" <-- modified
    RECEIVING
      container = go_cell_left.

Basically you need to set the rows and columns of the SPLITTER objects to suit your needs. Each cell has a CONTAINTER which you can later use.

Kind regards,
Mateusz

0 Kudos
3,821

Hi Mateusz

Now it looks like this...

I've tried it again myself, but unfortunately I don't understand it and it keeps looking worse.

Thanks

Marco

3,821

What you're doing here, is creating the second SPLITTER in the first row of the first SPLITTER. You need to create the second one in the second row of the first one, and the result will be what you want.

The whole logic is quite simple:

  1. Create a CONTAINER.
  2. Create SPLITTER1, in the CONTAINER, with 2 rows
  3. Get reference to the first row of the SPLITTER1.
  4. Create an ALV grid using the reference for the first row.
  5. Get reference to the second row of the SPLITTER1.
  6. Create SPLITTER2, using the reference for the second row, with 2 columns.
  7. Get reference to the first column of SPLITTER2.
  8. Create an ALV grid using the reference for the first column.
  9. Get reference to the second column of SPLITTER2.
  10. Create an ALV grid using the reference for the second column.

Kind regards,

Mateusz

marco_paroti
Explorer
0 Kudos
3,821

Hi Mateusz

Thanks. But now it looks like this:

before:

I don't get it ;-(

Best regards,

Marco

0 Kudos
3,821

Hi

I've modified my answer. Please use "Comment" button if you want to comment answers/questions in the future.


Kind regards,
Mateusz

Sandra_Rossi
Active Contributor
3,821

Your starting point is one container "A" (custom container, docking container, dialogbox container, a container of a splitter container):

|-<A>-------------------------|
|                             |
|                             |
|                             |
|                             |
|                             |
|-----------------------------|

Inside container A, create a splitter container with 2 rows:

|-<A>-------------------------|
| |-<ROW1>------------------| |
| |                         | |
| |-<ROW2>------------------| |
| |                         | |
| |-------------------------| |
|-----------------------------|

Inside container ROW2, create a splitter container with 2 columns:

|-<ROW2>--------------------------|
| |-----------------------------| |
| |              |              | |
| |     LEFT     |   RIGHT      | |
| |              |              | |
| |-----------------------------| |
|---------------------------------|

RaymondGiuseppi
Active Contributor
0 Kudos
3,821

You created two columns and then split the left one into two rows, change your logic to creating two rows and then split bottom one into two columns.