Inhaltsverzeichnis für Liste

In der neuen Version der ST22, der Dumpanalyse, sieht man links ein Inhaltsverzeichnis des Dumps. Mit Doppelklick kann man den entsprechenden Abschnitt in der Liste springen. Mit diesem Programm zeigen wir Ihnen, wie es geht.

Screenshot

Coding

REPORT.

CLASS lcl_application DEFINITION DEFERRED.


DATA o_dock    TYPE REF TO            cl_gui_docking_container.
DATA o_tree    TYPE REF TO            cl_gui_simple_tree.
DATA o_appl    TYPE REF TO            lcl_application.
DATA gt_nodes  TYPE STANDARD TABLE OF mtreesnode.
DATA gs_node   TYPE                   mtreesnode.


PARAMETERS p_pagnum TYPE sypagno DEFAULT 10.


*———————————————————————-*
*       CLASS LCL_APPLICATION DEFINITION
*———————————————————————-*

CLASS lcl_application DEFINITION.

  PUBLIC SECTION.
    METHODS:
      handle_node_double_click
        FOR EVENT node_double_click
        OF cl_gui_simple_tree
        IMPORTING node_key.

ENDCLASS.                    „LCL_APPLICATION DEFINITION

*———————————————————————-*
*       CLASS LCL_APPLICATION IMPLEMENTATION
*———————————————————————-*

CLASS lcl_application IMPLEMENTATION.

  METHOD  handle_node_double_click.

    DATA lv_page TYPE i.
    lv_page = node_key.
    SCROLL LIST TO PAGE lv_page.

  ENDMETHOD.                    „HANDLE_NODE_DOUBLE_CLICK

ENDCLASS.                    „LCL_APPLICATION IMPLEMENTATION


START-OF-SELECTION.

  PERFORM init_dock.
  PERFORM list.

*&———————————————————————*
*&      Form  init_dock
*&———————————————————————*

FORM init_dock.

  DATA lt_events TYPE cntl_simple_events.
  DATA ls_event  TYPE cntl_simple_event.


*– Create docking control
  CREATE OBJECT o_dock
    EXPORTING
      side                    = o_dock->dock_at_left
      ratio                   = 30
      no_autodef_progid_dynnr = ‚X‘.

*– Create TreeControl
  CREATE OBJECT o_tree
    EXPORTING
      parent              = o_dock
      node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single.

*– build tree
  CLEAR gs_node.
  gs_node-node_key = ‚Root‘.                                „#EC NOTEXT
  gs_node-isfolder = ‚X‘.      “ a folder.
  gs_node-text     = ‚Seiten‘.
  APPEND gs_node TO gt_nodes.

  DO p_pagnum TIMES.
*– build one tree nodes for each page
    CLEAR gs_node.
    gs_node-node_key  = sy-index.
    gs_node-relatkey  = ‚Root‘.
    gs_node-relatship = cl_gui_simple_tree=>relat_last_child.
    gs_node-text      = sy-index.
    shift gs_node-text LEFT DELETING LEADING space.
    APPEND gs_node TO gt_nodes.
  ENDDO.

*– set nodes
  CALL METHOD o_tree->add_nodes
    EXPORTING
      table_structure_name = ‚MTREESNODE‘
      node_table           = gt_nodes.

*– expand root
  CALL METHOD o_tree->expand_root_nodes.

*– set events
  ls_event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
  ls_event-appl_event = ‚X‘. “ process PAI if event occurs
  APPEND ls_event TO lt_events.

*– register
  CALL METHOD o_tree->set_registered_events
    EXPORTING
      events = lt_events.

*– create application
  CREATE OBJECT o_appl.

*– assign event handlers 
  SET HANDLER o_appl->handle_node_double_click FOR o_tree.

ENDFORM.                    „init_dock

*&———————————————————————*
*&      Form  list
*&———————————————————————*

FORM list.

  DO p_pagnum TIMES.

    DO 20 TIMES.
      WRITE: / ‚Seite‘, sy-pagno, ‚=> Zeile‘, sy-index.
    ENDDO.
    NEW-PAGE.
  ENDDO.

ENDFORM.                    „list

 

image_pdfimage_print
Enno Wulff
follow me
Letzte Artikel von Enno Wulff (Alle anzeigen)