Skip to Content
Technical Articles
Author's profile photo Soonhye "Sunny" Jeun

Docking Container w. no_autodef_progid_dynnr option(Create a screen-independent container)

If you look at Object Navigator (T-code SE80), you can see that the right screen continues to change while the left screen remains the same according to the information selected in the tree on the left. As such, a docking container that operates regardless of screen changes can be implemented as a simple option.

Let’s implement a tree that has a menu that simply moves between screens, and implements a screen that changes depending on the selection.

First, if we implement it as a general docking container we know without changing any options, it becomes as follows.

In this program, if screen number 200 is selected, the left tree disappears and only screen 200 appears as shown below.

[Case of General]

However, by changing only one option, it can be implemented as follows.

[Case of Option Specified]


1. Create docking container and menus

  INHERITING FROM cl_gui_docking_container.

    METHODS constructor IMPORTING iv_no_autodef TYPE abap_bool.

    DATA mo_tree TYPE REF TO cl_gui_alv_tree.
    DATA mt_menu TYPE TABLE OF scmgreadmenuitem.
    DATA ms_current_menu LIKE LINE OF mt_menu.

    METHODS handle_node_double_click FOR EVENT node_double_click OF cl_gui_alv_tree
      IMPORTING node_key.

  METHOD constructor.
    super->constructor( side                    = dock_at_left
                        ratio                   = 30 ).

    mo_tree = NEW #( parent         = me
                     no_html_header = abap_true
                     no_toolbar     = abap_true
                     item_selection = abap_false ).
    mo_tree->set_table_for_first_display( EXPORTING i_structure_name    = 'SCMGREADMENUITEM'
                                                    is_hierarchy_header = VALUE #( heading = 'Menu' width = 50 )
                                          CHANGING  it_outtab           = mt_menu ).

    mo_tree->add_node( EXPORTING i_relat_node_key = space
                                 i_relationship   = cl_gui_column_tree=>relat_last_child
                                 is_node_layout   = VALUE #( isfolder = abap_true )
                                 i_node_text      = 'Root'
                       IMPORTING e_new_node_key   = DATA(root_node) ).

    mo_tree->add_node( EXPORTING i_relat_node_key = root_node
                                 i_relationship   = cl_gui_column_tree=>relat_last_child
                                 is_outtab_line   = VALUE scmgreadmenuitem( event_name = 'Screen 100' menu_item = '0100' )
                                 is_node_layout   = VALUE #( isfolder = abap_false )
                                 i_node_text      = 'Go to 100' ).
    mo_tree->add_node( EXPORTING i_relat_node_key = root_node
                                 i_relationship   = cl_gui_column_tree=>relat_last_child
                                 is_outtab_line   = VALUE scmgreadmenuitem( event_name = 'Screen 200' menu_item = '0200' )
                                 is_node_layout   = VALUE #( isfolder = abap_false )
                                 i_node_text      = 'Go to 200' ).
    mo_tree->frontend_update( ).
    mo_tree->expand_node( i_node_key       = root_node
                          i_expand_subtree = abap_true ).

    ms_current_menu-menu_item = '0100'.

    mo_tree->set_registered_events( VALUE #( ( eventid = cl_gui_column_tree=>eventid_node_double_click ) ) ).

    SET HANDLER handle_node_double_click FOR mo_tree.

2. Event Handler

  METHOD handle_node_double_click.
    DATA ls_outtab TYPE scmgreadmenuitem.

    mo_tree->get_outtab_line( EXPORTING i_node_key    = node_key
                              IMPORTING e_outtab_line = ls_outtab ).

    CHECK ms_current_menu-menu_item <> ls_outtab-menu_item.

    ms_current_menu = ls_outtab.

    cl_gui_cfw=>set_new_ok_code( CONV #( ls_outtab-menu_item ) ).



3. User Command

  CASE sy-ucomm.
    WHEN '0100'. LEAVE TO SCREEN 100.
    WHEN '0200'. LEAVE TO SCREEN 200.


When the program is configured like this, the same result as [Case of General] is obtained. However, you can get what you want with the following modifications:

    super->constructor( side                    = dock_at_left
                        ratio                   = 30
                        no_autodef_progid_dynnr = abap_true ).

It’s a very simple way, but the results are powerful. I hope this is helpful for those who want to configure a cockpit program or an integrated launcher(like T-code ST04). However, since it has nothing to do with screen movement, event handling and program flow require a lot of thought.

For reference, there are three more containers that have this option:





If you have any questions or improvements, please feel free to leave a comment.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sandra Rossi
      Sandra Rossi

      Thanks. I don't know the effect of parameter "no_autodef_progid_dynnr = abap_true" and alas I didn't understand well your explanations, so I wanted to test quickly your program. Could you provide a fully-running example please? (if possible with a selection screen to avoid to create manually the dynpro screens, or GitHub/abapGit repository if you know). Thank you!

      Author's profile photo Soonhye "Sunny" Jeun
      Soonhye "Sunny" Jeun
      Blog Post Author

      I'm glad you tried this tip. If you don't know why you use it, it's my lack of explanation.

      It is essential if you are trying to configure an integrated launcher or cockpit program(like T-code ST04). I will also edit the blog.

      Thanks for commenting.