Application Development 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: 

ALV WITH TWO CONTAINER ON ONE PAGE

Former Member
0 Kudos

Hi,

I want to create an ALV which displays certain records , and when I select any records I want another ALV report for the related line selected on the same page having selection enabled as first alv, please suggest how to do it, or send some sample code

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Look at the below threads ...

Regards

Sudheer

9 REPLIES 9

Former Member
0 Kudos

hi ,

create a screen and place 2 custom container in screen.

Using CL_GUI_ALV_GRID with ref to CL_GUI_CUSTOM_CONTAINER,

use SET_SELECTED_ROWS AND GET_SELECTED_ROWS methods..

check standard program:

<b>BCALV_TEST_GRID_DRAG_DROP</b>

Regards

SAB

Former Member
0 Kudos

Hi,

Look at the below threads ...

Regards

Sudheer

0 Kudos

Hi. Implement the following program. This program actually implements the grids in docking containers. I did this to provide a cut/paste solution. You can very easily convert this to work in a dynpro container instead. Run the program, then double click on a material, you will then see the MARC records for that material in the ALV at the bottom.



report zrich_0001 .

data: imara type table of mara.
data: xmara like line of imara.
data: imarc type table of marc.

data: dockingbottom type ref to cl_gui_docking_container,
      dockingtop  type ref to cl_gui_docking_container,
      alv_bottom    type ref to cl_gui_alv_grid,
      alv_top     type ref to cl_gui_alv_grid,
      repid type syrepid.

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_event_handler definition.

  public section.

    class-methods handle_double_click
               for event double_click of cl_gui_alv_grid
                              importing e_row e_column.

endclass.

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_event_handler implementation.

  method handle_double_click.

    read table imara into xmara index e_row-index.

    select * into table imarc from marc
                  where matnr = xmara-matnr.
    call method alv_bottom->refresh_table_display( ).


  endmethod.

endclass.


parameters: p_check type c.

start-of-selection.

at selection-screen output.

  repid = sy-repid.

  select * into corresponding fields of table imara
              from mara up to 100 rows.

  check dockingbottom is initial.


  create object dockingtop
              exporting repid     = repid
                        dynnr     = sy-dynnr
                        side      = dockingtop->dock_at_top
                        extension = 200.

  create object alv_top
              exporting i_parent = dockingtop.


  call method alv_top->set_table_for_first_display
     exporting
          i_structure_name       = 'MARA'
     changing
          it_outtab       = imara[].


*   handler for ALV grid
  set handler lcl_event_handler=>handle_double_click for alv_top.



  create object dockingbottom
              exporting repid     = repid
                        dynnr     = sy-dynnr
                        side      = dockingbottom->dock_at_bottom
                        extension = 200.

  create object alv_bottom
                exporting i_parent = dockingbottom.


  call method alv_bottom->set_table_for_first_display
      exporting
           i_structure_name       = 'MARC'
      changing
           it_outtab       = imarc[].

Regards,

Rich HEilman

0 Kudos

Hi Rich,

can you telll me how to put my own toolbar in the bottom alv with my customised buttons,

thanks

pankaj

0 Kudos

Hi Pankaj,

Here is code for the toolbar part.

Hope this helps. If it does, pls reward points.

Rgds,

Prash.

SAP.

1. In lcl_event_handler definition.
public section.
 
*   Add this code after the definition of handle_double_click method.

*   Handle toolbar
    methods:
	handle_toolbar
          FOR EVENT toolbar OF cl_gui_alv_grid
          IMPORTING e_object
                    e_interactive.



2. In class lcl_event_handler implementation, add this implementation.

* Handler for toolbar event
  METHOD handle_toolbar.
    PERFORM handle_toolbar USING e_object.
  ENDMETHOD.                    "handle_toolbar




3. Implementation of the perform.

FORM handle_toolbar  USING    pv_object TYPE REF TO
cl_alv_event_toolbar_set.
  DATA:
  ls_toolbar TYPE stb_button.

  ls_toolbar-function = 'SEP'.
  ls_toolbar-quickinfo =  ' '.
  ls_toolbar-butn_type = 3.
  APPEND ls_toolbar TO pv_object->mt_toolbar.
  CLEAR ls_toolbar.


  ls_toolbar-function = 'APPEND'.
  ls_toolbar-icon = '@17@'.
  ls_toolbar-quickinfo = 'Append Row'.
  ls_toolbar-butn_type = 0.
  APPEND ls_toolbar TO pv_object->mt_toolbar.
  CLEAR ls_toolbar.

ENDFORM.                    " handle_toolbar

0 Kudos

Hi,

I have applied the toolbar code but its not displaying , Please suggest what is wrong in my code . I am attaching the code

REPORT ztestpkg .

----


  • Type pools *

----


TYPE-POOLS: slis.

----


  • Screen Interface *

----


TABLES: marc, lfa1, makt, eine, eina, a017, konp.

----


  • Global Variables *

----


  • ALV Declaration

DATA: dockingbottom TYPE REF TO cl_gui_docking_container,

dockingtop TYPE REF TO cl_gui_docking_container,

alv_bottom TYPE REF TO cl_gui_alv_grid,

alv_top TYPE REF TO cl_gui_alv_grid,

repid TYPE syrepid.

----


  • Types *

----


TYPES : BEGIN OF x_eine_eina,

infnr LIKE eina-infnr,

matnr LIKE eina-matnr,

lifnr LIKE eina-lifnr,

ekorg LIKE eine-ekorg,

esokz LIKE eine-esokz,

werks LIKE eine-werks,

ekgrp LIKE eine-ekgrp,

norbm LIKE eine-norbm,

meins LIKE eina-meins,

aplfz LIKE eine-aplfz,

effpr LIKE eine-effpr,

waers LIKE eine-waers,

peinh LIKE eine-peinh,

bstae LIKE eine-bstae,

prdat LIKE eine-prdat,

END OF x_eine_eina,

BEGIN OF x_makt,

matnr LIKE makt-matnr,

maktx LIKE makt-maktx,

END OF x_makt,

BEGIN OF x_lfa1,

lifnr LIKE lfa1-lifnr,

name1 LIKE lfa1-name1,

END OF x_lfa1,

BEGIN OF x_marc,

matnr LIKE marc-matnr,

werks LIKE marc-werks,

END OF x_marc,

BEGIN OF x_final,

infnr LIKE eina-infnr,

matnr LIKE eina-matnr,

maktx LIKE makt-maktx,

lifnr LIKE eina-lifnr,

name1 LIKE lfa1-name1,

ekorg LIKE eine-ekorg,

esokz LIKE eine-esokz,

werks LIKE eine-werks,

ekgrp LIKE eine-ekgrp,

norbm LIKE eine-norbm,

meins LIKE eina-meins,

aplfz LIKE eine-aplfz,

effpr LIKE eine-effpr,

waers LIKE eine-waers,

peinh LIKE eine-peinh,

bstae LIKE eine-bstae,

prdat LIKE eine-prdat,

END OF x_final.

----


  • Internal Tables *

----


DATA:

t_eine_eina TYPE STANDARD TABLE OF x_eine_eina,

t_eine_eina1 TYPE STANDARD TABLE OF x_eine_eina,

t_makt TYPE STANDARD TABLE OF x_makt,

t_lfa1 TYPE STANDARD TABLE OF x_lfa1,

t_final_1 TYPE STANDARD TABLE OF x_final,

t_final_2 TYPE STANDARD TABLE OF x_final,

t_marc TYPE STANDARD TABLE OF x_marc.

----


  • Work Area *

----


DATA: wa_eine_eina TYPE x_eine_eina,

wa_makt TYPE x_makt,

wa_lfa1 TYPE x_lfa1,

wa_final_1 TYPE x_final,

wa_marc TYPE x_marc,

wa_final_2 TYPE x_final.

----


  • Variables *

----


DATA : g_repid LIKE sy-repid.

  • Work areas for ALV

DATA :

t_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat WITH HEADER LINE,

wa_fieldcat TYPE lvc_s_fcat,

t_fieldcat1 TYPE STANDARD TABLE OF lvc_s_fcat WITH HEADER LINE,

wa_fieldcat1 TYPE lvc_s_fcat.

  • .

----


  • Selection Screen *

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

SELECT-OPTIONS: s_matnr FOR eina-matnr,

s_lifnr FOR eina-lifnr,

s_werks FOR eine-werks,

s_infnr FOR eina-infnr,

s_esokz FOR eine-esokz.

SELECTION-SCREEN END OF BLOCK b1.

************************************************************************

  • AT SELECTION SCREEN *

************************************************************************

AT SELECTION-SCREEN OUTPUT.

g_repid = sy-repid.

************************************************************************

  • Class *

************************************************************************

----


  • CLASS lcl_event_handler DEFINITION

----


CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

CLASS-METHODS handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column.

  • Handle toolbar

CLASS-METHODS handle_toolbar

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object

e_interactive.

ENDCLASS.

----


  • CLASS lcl_event_handler IMPLEMENTATION

----


  • ........ *

----


CLASS lcl_event_handler IMPLEMENTATION.

  • Handler for toolbar event

METHOD handle_toolbar.

PERFORM f_handle_toolbar USING e_object e_interactive.

ENDMETHOD. "handle_toolbar

METHOD handle_double_click.

READ TABLE t_final_1 INTO wa_final_1 INDEX e_row-index.

SELECT matnr werks FROM marc INTO TABLE t_marc

WHERE matnr = wa_final_1-matnr

AND werks = wa_final_1-werks.

IF sy-subrc = 0.

SELECT ainfnr amatnr alifnr bekorg besokz bwerks b~ekgrp

bnorbm ameins baplfz beffpr bwaers bpeinh bbstae bprdat

FROM eina AS a

INNER JOIN eine AS b

ON ainfnr = binfnr

INTO TABLE t_eine_eina1

FOR ALL ENTRIES IN t_marc

WHERE a~matnr = t_marc-matnr AND

b~werks = t_marc-werks .

ENDIF.

CLEAR : t_final_2[].

LOOP AT t_eine_eina1 INTO wa_eine_eina.

READ TABLE t_makt INTO wa_makt WITH KEY matnr = wa_eine_eina-matnr

BINARY SEARCH.

READ TABLE t_lfa1 INTO wa_lfa1 WITH KEY lifnr = wa_eine_eina-lifnr

BINARY SEARCH.

wa_final_2-infnr = wa_eine_eina-infnr.

wa_final_2-matnr = wa_eine_eina-matnr.

wa_final_2-maktx = wa_makt-maktx.

wa_final_2-lifnr = wa_eine_eina-lifnr.

wa_final_2-name1 = wa_lfa1-name1.

wa_final_2-ekorg = wa_eine_eina-ekorg.

wa_final_2-esokz = wa_eine_eina-esokz.

wa_final_2-werks = wa_eine_eina-werks.

wa_final_2-ekgrp = wa_eine_eina-ekgrp.

wa_final_2-norbm = wa_eine_eina-norbm.

wa_final_2-meins = wa_eine_eina-meins.

wa_final_2-aplfz = wa_eine_eina-aplfz.

wa_final_2-effpr = wa_eine_eina-effpr.

wa_final_2-waers = wa_eine_eina-waers.

wa_final_2-peinh = wa_eine_eina-peinh.

wa_final_2-bstae = wa_eine_eina-bstae.

wa_final_2-prdat = wa_eine_eina-prdat.

APPEND wa_final_2 TO t_final_2.

CLEAR : wa_final_2,wa_makt,wa_lfa1,wa_eine_eina.

ENDLOOP.

CALL METHOD alv_bottom->refresh_table_display( ).

ENDMETHOD.

ENDCLASS.

----


  • FORM f_handle_toolbar *

----


  • ........ *

----


  • --> PV_OBJECT *

  • --> E_INTERACTIVE *

----


FORM f_handle_toolbar USING pv_object TYPE REF TO

cl_alv_event_toolbar_set

e_interactive TYPE char1.

DATA:

ls_toolbar TYPE stb_button.

ls_toolbar-function = 'DEL'.

ls_toolbar-quickinfo = 'Delete Row'.

ls_toolbar-butn_type = '3'.

APPEND ls_toolbar TO pv_object->mt_toolbar.

CLEAR ls_toolbar.

ls_toolbar-function = 'APPEND'.

  • ls_toolbar-icon = '@17@'.

ls_toolbar-quickinfo = 'Append Row'.

ls_toolbar-butn_type = '0'.

APPEND ls_toolbar TO pv_object->mt_toolbar.

CLEAR ls_toolbar.

ENDFORM. " f_handle_toolbar

************************************************************************

  • START-OF-SELECTION *

************************************************************************

START-OF-SELECTION.

  • Get the data from the tables.

PERFORM f_getdata.

  • Create Field Catalog.

PERFORM f_create_fieldcat.

CALL SCREEN '0100'.

----


  • End-Of-Selection Event *

----


END-OF-SELECTION.

&----


*& Form F_GETDATA

&----


FORM f_getdata.

SELECT ainfnr amatnr alifnr bekorg besokz bwerks bekgrp bnorbm

ameins baplfz beffpr bwaers bpeinh bbstae b~prdat

FROM eina AS a

INNER JOIN eine AS b

ON ainfnr = binfnr

INTO TABLE t_eine_eina

WHERE a~matnr IN s_matnr AND

a~lifnr IN s_lifnr AND

b~werks IN s_werks AND

a~infnr IN s_infnr AND

b~esokz IN s_esokz.

IF sy-subrc = 0.

SELECT matnr maktx FROM makt INTO TABLE t_makt

FOR ALL ENTRIES IN t_eine_eina

WHERE matnr = t_eine_eina-matnr

AND spras = sy-langu.

IF sy-subrc = 0.

SORT t_makt BY matnr.

ENDIF.

SELECT lifnr name1 FROM lfa1 INTO TABLE t_lfa1

FOR ALL ENTRIES IN t_eine_eina

WHERE lifnr = t_eine_eina-lifnr.

IF sy-subrc = 0.

SORT t_lfa1 BY lifnr.

ENDIF.

LOOP AT t_eine_eina INTO wa_eine_eina.

READ TABLE t_makt INTO wa_makt WITH KEY matnr = wa_eine_eina-matnr

BINARY SEARCH.

READ TABLE t_lfa1 INTO wa_lfa1 WITH KEY lifnr = wa_eine_eina-lifnr

BINARY SEARCH.

wa_final_1-infnr = wa_eine_eina-infnr.

wa_final_1-matnr = wa_eine_eina-matnr.

wa_final_1-maktx = wa_makt-maktx.

wa_final_1-lifnr = wa_eine_eina-lifnr.

wa_final_1-name1 = wa_lfa1-name1.

wa_final_1-ekorg = wa_eine_eina-ekorg.

wa_final_1-esokz = wa_eine_eina-esokz.

wa_final_1-werks = wa_eine_eina-werks.

wa_final_1-ekgrp = wa_eine_eina-ekgrp.

wa_final_1-norbm = wa_eine_eina-norbm.

wa_final_1-meins = wa_eine_eina-meins.

wa_final_1-aplfz = wa_eine_eina-aplfz.

wa_final_1-effpr = wa_eine_eina-effpr.

wa_final_1-waers = wa_eine_eina-waers.

wa_final_1-peinh = wa_eine_eina-peinh.

wa_final_1-bstae = wa_eine_eina-bstae.

wa_final_1-prdat = wa_eine_eina-prdat.

APPEND wa_final_1 TO t_final_1.

CLEAR : wa_final_1,wa_makt,wa_lfa1,wa_eine_eina.

ENDLOOP.

ENDIF.

ENDFORM. " F_GETDATA

&----


*& Form F_CREATE_FIELDCAT

&----


FORM f_create_fieldcat.

*Subroutine to Fill Field catalog Fields

PERFORM f_fill_fields USING 'T_FINAL_1' 'INFNR'

'Info Record Number' 10 '' 1.

PERFORM f_fill_fields USING 'T_FINAL_1' 'MATNR'

'Material' 18 '' 2.

PERFORM f_fill_fields USING 'T_FINAL_1' 'MAKTX'

text-f03 40 '' 3.

PERFORM f_fill_fields USING 'T_FINAL_1' 'LIFNR'

text-f04 10 '' 4.

PERFORM f_fill_fields USING 'T_FINAL_1' 'NAME1'

text-f05 40 '' 5.

PERFORM f_fill_fields USING 'T_FINAL_1' 'EKORG'

text-f06 24 '' 6.

PERFORM f_fill_fields USING 'T_FINAL_1' 'ESOKZ'

text-f07 10 '' 7.

PERFORM f_fill_fields USING 'T_FINAL_1' 'WERKS'

'Plant' 10 '' 8.

PERFORM f_fill_fields USING 'T_FINAL_1' 'EKGRP'

text-f09 10 '' 9.

PERFORM f_fill_fields USING 'T_FINAL_1' 'NORBM'

text-f10 14 '' 10.

PERFORM f_fill_fields USING 'T_FINAL_1' 'MEINS'

text-f11 10 '' 11.

PERFORM f_fill_fields USING 'T_FINAL_1' 'APLFZ'

text-f12 10 '' 12.

PERFORM f_fill_fields USING 'T_FINAL_1' 'EFFPR'

text-f13 15 '' 13.

PERFORM f_fill_fields USING 'T_FINAL_1' 'WAERS'

text-f14 10 '' 14.

PERFORM f_fill_fields USING 'T_FINAL_1' 'PEINH'

text-f15 10 '' 15.

PERFORM f_fill_fields USING 'T_FINAL_1' 'BSTAE'

text-f16 10 '' 16.

PERFORM f_fill_fields USING 'T_FINAL_1' 'PRDAT'

text-f17 10 '' 17.

*****

*Subroutine to Fill Field catalog Fields2

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'INFNR'

'Info Record' 10 '' 1.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'MATNR'

text-f02 18 '' 2.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'MAKTX'

text-f03 40 '' 3.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'LIFNR'

text-f04 10 '' 4.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'NAME1'

text-f05 40 '' 5.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'EKORG'

text-f06 24 '' 6.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'ESOKZ'

text-f07 10 '' 7.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'WERKS'

text-f08 10 '' 8.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'EKGRP'

text-f09 10 '' 9.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'NORBM'

text-f10 14 '' 10.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'MEINS'

text-f11 10 '' 11.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'APLFZ'

text-f12 10 '' 12.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'EFFPR'

text-f13 15 '' 13.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'WAERS'

text-f14 10 '' 14.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'PEINH'

text-f15 10 '' 15.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'BSTAE'

text-f16 10 '' 16.

PERFORM f_fill_fields1 USING 'T_FINAL_2' 'PRDAT'

text-f17 10 '' 17.

ENDFORM. " F_CREATE_FIELDCAT

&----


*& Form F_FILL_FIELDS

&----


  • Subroutine to Fill Field catalog Fields For Detail RPT

----


  • -->P_T_FIELDCAT Field catalog

  • -->P_TABNAME Internal table name

  • -->P_FIELDNAME Internal table field Name

  • -->P_SELTEXT_L Field caption (text symbol)

  • -->P_LENGTH Output length

----


FORM f_fill_fields USING p_tabname TYPE any

p_fieldname TYPE any

p_seltext TYPE any

p_length TYPE any

p_sum TYPE any

p_col TYPE any.

wa_fieldcat-tabname = p_tabname.

wa_fieldcat-fieldname = p_fieldname.

wa_fieldcat-scrtext_l = p_seltext.

wa_fieldcat-col_pos = p_col.

APPEND wa_fieldcat TO t_fieldcat.

CLEAR wa_fieldcat.

ENDFORM. " F_FILL_FIELDS

&----


*& Form F_FILL_FIELDS1

&----


  • Subroutine to Fill Field catalog Fields For Detail RPT

----


  • -->P_T_FIELDCAT Field catalog

  • -->P_TABNAME Internal table name

  • -->P_FIELDNAME Internal table field Name

  • -->P_SELTEXT_L Field caption (text symbol)

  • -->P_LENGTH Output length

----


FORM f_fill_fields1 USING p_tabname TYPE any

p_fieldname TYPE any

p_seltext TYPE any

p_length TYPE any

p_sum TYPE any

p_col TYPE any.

wa_fieldcat1-tabname = p_tabname.

wa_fieldcat1-fieldname = p_fieldname.

wa_fieldcat1-scrtext_l = p_seltext.

wa_fieldcat1-col_pos = p_col.

APPEND wa_fieldcat1 TO t_fieldcat1.

CLEAR wa_fieldcat1.

ENDFORM. " F_FILL_FIELDS

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module DISPLAY_DATA OUTPUT

&----


  • text

----


MODULE display_data OUTPUT.

CHECK dockingbottom IS INITIAL.

CREATE OBJECT dockingtop

EXPORTING repid = repid

dynnr = sy-dynnr

side = dockingtop->dock_at_top

extension = 200.

CREATE OBJECT alv_top

EXPORTING i_parent = dockingtop.

CALL METHOD alv_top->set_table_for_first_display

  • EXPORTING

  • IS_LAYOUT =

CHANGING

it_outtab = t_final_1[]

it_fieldcatalog = t_fieldcat[].

  • handler for ALV grid

SET HANDLER lcl_event_handler=>handle_double_click FOR alv_top.

CREATE OBJECT dockingbottom

EXPORTING repid = repid

dynnr = sy-dynnr

side = dockingbottom->dock_at_bottom

extension = 200.

CREATE OBJECT alv_bottom

EXPORTING i_parent = dockingbottom.

CALL METHOD alv_bottom->set_table_for_first_display

CHANGING

it_outtab = t_final_2[]

it_fieldcatalog = t_fieldcat1[].

ENDMODULE. " DISPLAY_DATA OUTPUT

thanks

0 Kudos

Hi,

Add this code, and it shd be done.

1. Declare in top.

go_event_receiver    TYPE REF TO lcl_event_handler.

2. Before call to set_table_for_display, make the following code as well.

*  Object for handling events
CREATE OBJECT go_event_receiver.

 SET HANDLER go_event_receiver->handle_toolbar FOR alv_top. "(or alv_botton)

Rememeber to reward points if this does help.

Rgds,

Prashanth.

SAP Labs.

uwe_schieferstein
Active Contributor
0 Kudos

Hello Pankaj

The following sample report display three ALV lists at the same time.

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_ALV_GRID_SPLITTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
REPORT  zus_sdn_alv_grid_splitter.
 
 
 
DATA:
  gt_t001         TYPE STANDARD TABLE OF t001,
  gt_kna1         TYPE STANDARD TABLE OF kna1,
  gt_knb1         TYPE STANDARD TABLE OF knb1.
 
DATA:
  go_docking      TYPE REF TO cl_gui_docking_container,
  go_splitter     TYPE REF TO cl_gui_splitter_container,
  go_splitter_1   TYPE REF TO cl_gui_splitter_container,
  go_cell_left    TYPE REF TO cl_gui_container,
  go_cell_right   TYPE REF TO cl_gui_container,
  go_cell_top     TYPE REF TO cl_gui_container,
  go_cell_bottom  TYPE REF TO cl_gui_container,
  go_grid_top     TYPE REF TO cl_gui_alv_grid,
  go_grid_bottom  TYPE REF TO cl_gui_alv_grid,
  go_grid_right   TYPE REF TO cl_gui_alv_grid.
 
 
 
START-OF-SELECTION.
 
  SELECT * FROM  t001 INTO TABLE gt_t001.
  SELECT * FROM  kna1 INTO TABLE gt_kna1.
  SELECT * FROM  knb1 INTO TABLE gt_knb1.
 
 
 
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
*      REPID                       =
*      DYNNR                       =
       side                        =
             cl_gui_docking_container=>dock_at_left
*      EXTENSION                   = 50
*      STYLE                       =
*      LIFETIME                    = lifetime_default
*      CAPTION                     =
*      METRIC                      = 0
      ratio                       = 90
*      NO_AUTODEF_PROGID_DYNNR     =
*      NAME                        =
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5
      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.
 
* Use full dynpro size
  CALL METHOD go_docking->set_extension
    EXPORTING
      extension  = 99999
    EXCEPTIONS
      cntl_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.
 
  CREATE OBJECT go_splitter
    EXPORTING
*      LINK_DYNNR        =
*      LINK_REPID        =
*      SHELLSTYLE        =
*      LEFT              =
*      TOP               =
*      WIDTH             =
*      HEIGHT            =
*      METRIC            = cntl_metric_dynpro
*      ALIGN             = 15
      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.
 
 
  CALL METHOD go_splitter->set_column_mode
    EXPORTING
      mode              = cl_gui_splitter_container=>mode_relative
*    IMPORTING
*      RESULT            =
    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.
 
 
* Set column width: 1st column = 85%, 2nd column = 15%
  CALL METHOD go_splitter->set_column_width
    EXPORTING
      id                = 1
      width             = 85                                " 85%
*    IMPORTING
*      RESULT            =
    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.
 
 
 
  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.
 
 
* 2nd splitter for top/bottom
  CREATE OBJECT go_splitter_1
    EXPORTING
*      LINK_DYNNR        =
*      LINK_REPID        =
*      SHELLSTYLE        =
*      LEFT              =
*      TOP               =
*      WIDTH             =
*      HEIGHT            =
*      METRIC            = cntl_metric_dynpro
*      ALIGN             = 15
      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.
 
 
  CALL METHOD go_splitter_1->set_column_mode
    EXPORTING
      mode              = cl_gui_splitter_container=>mode_relative
*    IMPORTING
*      RESULT            =
    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.
 
 
* Set column width: 1st column = 85%, 2nd column = 15%
  CALL METHOD go_splitter_1->set_row_height
    EXPORTING
      id                = 1
      height            = 75
*    IMPORTING
*      RESULT            =
    EXCEPTIONS
      cntl_error        = 1
      cntl_system_error = 2
      OTHERS            = 3.
 
  CALL METHOD go_splitter_1->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = go_cell_top.
  CALL METHOD go_splitter_1->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = go_cell_bottom.
 
 
 
 
 
  CREATE OBJECT go_grid_top
    EXPORTING
*      I_SHELLSTYLE      = 0
*      I_LIFETIME        =
      i_parent          = go_cell_top
*      I_APPL_EVENTS     = space
*      I_PARENTDBG       =
*      I_APPLOGPARENT    =
*      I_GRAPHICSPARENT  =
*      I_NAME            =
    EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init   = 2
      error_cntl_link   = 3
      error_dp_create   = 4
      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_grid_bottom
    EXPORTING
*      I_SHELLSTYLE      = 0
*      I_LIFETIME        =
      i_parent          = go_cell_bottom
*      I_APPL_EVENTS     = space
*      I_PARENTDBG       =
*      I_APPLOGPARENT    =
*      I_GRAPHICSPARENT  =
*      I_NAME            =
    EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init   = 2
      error_cntl_link   = 3
      error_dp_create   = 4
      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_grid_right
    EXPORTING
*      I_SHELLSTYLE      = 0
*      I_LIFETIME        =
      i_parent          = go_cell_right
*      I_APPL_EVENTS     = space
*      I_PARENTDBG       =
*      I_APPLOGPARENT    =
*      I_GRAPHICSPARENT  =
*      I_NAME            =
    EXCEPTIONS
      error_cntl_create = 1
      error_cntl_init   = 2
      error_cntl_link   = 3
      error_dp_create   = 4
      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.
 
 
  CALL METHOD go_grid_top->set_table_for_first_display
    EXPORTING
*      I_BUFFER_ACTIVE               =
*      I_BYPASSING_BUFFER            =
*      I_CONSISTENCY_CHECK           =
      i_structure_name              = 'T001'
*      IS_VARIANT                    =
      i_save                        = 'A'
*      I_DEFAULT                     = 'X'
*      IS_LAYOUT                     =
*      IS_PRINT                      =
*      IT_SPECIAL_GROUPS             =
*      IT_TOOLBAR_EXCLUDING          =
*      IT_HYPERLINK                  =
*      IT_ALV_GRAPHICS               =
*      IT_EXCEPT_QINFO               =
    CHANGING
      it_outtab                     = gt_t001
*      it_fieldcatalog               =
*      IT_SORT                       =
*      IT_FILTER                     =
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      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.
 
 
  CALL METHOD go_grid_bottom->set_table_for_first_display
    EXPORTING
*      I_BUFFER_ACTIVE               =
*      I_BYPASSING_BUFFER            =
*      I_CONSISTENCY_CHECK           =
      i_structure_name              = 'KNA1'
*      IS_VARIANT                    =
      i_save                        = 'A'
*      I_DEFAULT                     = 'X'
*      IS_LAYOUT                     =
*      IS_PRINT                      =
*      IT_SPECIAL_GROUPS             =
*      IT_TOOLBAR_EXCLUDING          =
*      IT_HYPERLINK                  =
*      IT_ALV_GRAPHICS               =
*      IT_EXCEPT_QINFO               =
    CHANGING
      it_outtab                     = gt_kna1
*      it_fieldcatalog               =
*      IT_SORT                       =
*      IT_FILTER                     =
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      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.
 
  CALL METHOD go_grid_right->set_table_for_first_display
    EXPORTING
*      I_BUFFER_ACTIVE               =
*      I_BYPASSING_BUFFER            =
*      I_CONSISTENCY_CHECK           =
      i_structure_name              = 'KNB1'
*      IS_VARIANT                    =
      i_save                        = 'A'
*      I_DEFAULT                     = 'X'
*      IS_LAYOUT                     =
*      IS_PRINT                      =
*      IT_SPECIAL_GROUPS             =
*      IT_TOOLBAR_EXCLUDING          =
*      IT_HYPERLINK                  =
*      IT_ALV_GRAPHICS               =
*      IT_EXCEPT_QINFO               =
    CHANGING
      it_outtab                     = gt_knb1
*      it_fieldcatalog               =
*      IT_SORT                       =
*      IT_FILTER                     =
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      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 docking container to dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      lifetime_dynpro_dynpro_link = 3
      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.
 
 
  CALL SCREEN '0100'.
* NOTE: Dynpro does not contain any elements and has the following
*       flow logic:
 
"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 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
 
ENDMODULE.                 " STATUS_0100  OUTPUT
 
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
 
  SET SCREEN 0. LEAVE SCREEN.
 
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Regards

Uwe

Former Member
0 Kudos

I have a query