导读:
REPORT BCALV_TREE_01.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* Purpose:
* ~~~~~~~~
* This report shows the essential steps to build up a hierarchy
* using an ALV Tree Control (class CL_GUI_ALV_TREE).
* Note that it is _not_ possible to build up this hierarchy
* using a simple ALV Tree Control (class CL_GUI_ALV_TREE_SIMPLE).
*-----------------------------------------------------------------
* To check program behavior
* ~~~~~~~~~~~~~~~~~~~~~~~~~
* Start this report. The hierarchy tree consists of nodes for each
* month on top level (this level can not be build by a simple ALV Tree
* because there is no field for months in our output table SFLIGHT.
* Thus, you can not define this hierarchy by sorting).
* Nor initial calculations neither a special layout has been applied
* (the lines on the right do not show anything).
* Note also that this example does not build up and change the
* fieldcatalog of the output table. For this reason, _all_ fields
* of the output table are shown in the columns although the fields
* CARRID and FLDATE are already placed in the tree on the left.
* (Of course, this is not a good style. See BCALV_TREE_02 on how to
* hide columns).
*-------------------------------------------------------------------
* Essential steps (Search for ')
* ~~~~~~~~~~~~~~~
* 1.Usual steps when using control technology.
* 1a. Define reference variables.
* 1b. Create ALV Tree Control and corresponding container.
*
* 2.Create Hierarchy-header
* 3.Create empty Tree Control
* 4.Create hierarchy (nodes and leaves)
* 4a. Select data
* 4b. Sort output table according to your conceived hierarchy
* 4c. Add data to tree
*
* 5.Send data to frontend.
* 6.Call dispatch to process toolbar functions
*
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* 1a. Define reference variables
* 定义关键使用的 ALV 的类 . 和自定义的容器
DATA: G_ALV_TREE TYPE REF TO CL_GUI_ALV_TREE,
G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*定义输出的表结构
DATA: GT_SFLIGHT TYPE SFLIGHT OCCURS 0, "Output-Table
OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM, "OK-Code
G_MAX TYPE I VALUE 255.
END-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module PBO OUTPUT
*&---------------------------------------------------------------------*
* process before output
*----------------------------------------------------------------------*
MODULE PBO OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAINTITLE'.
IF G_ALV_TREE IS INITIAL.
REPORT BCALV_TREE_01.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* Purpose:
* ~~~~~~~~
* This report shows the essential steps to build up a hierarchy
* using an ALV Tree Control (class CL_GUI_ALV_TREE).
* Note that it is _not_ possible to build up this hierarchy
* using a simple ALV Tree Control (class CL_GUI_ALV_TREE_SIMPLE).
*-----------------------------------------------------------------
* To check program behavior
* ~~~~~~~~~~~~~~~~~~~~~~~~~
* Start this report. The hierarchy tree consists of nodes for each
* month on top level (this level can not be build by a simple ALV Tree
* because there is no field for months in our output table SFLIGHT.
* Thus, you can not define this hierarchy by sorting).
* Nor initial calculations neither a special layout has been applied
* (the lines on the right do not show anything).
* Note also that this example does not build up and change the
* fieldcatalog of the output table. For this reason, _all_ fields
* of the output table are shown in the columns although the fields
* CARRID and FLDATE are already placed in the tree on the left.
* (Of course, this is not a good style. See BCALV_TREE_02 on how to
* hide columns).
*-------------------------------------------------------------------
* Essential steps (Search for ')
* ~~~~~~~~~~~~~~~
* 1.Usual steps when using control technology.
* 1a. Define reference variables.
* 1b. Create ALV Tree Control and corresponding container.
*
* 2.Create Hierarchy-header
* 3.Create empty Tree Control
* 4.Create hierarchy (nodes and leaves)
* 4a. Select data
* 4b. Sort output table according to your conceived hierarchy
* 4c. Add data to tree
*
* 5.Send data to frontend.
* 6.Call dispatch to process toolbar functions
*
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* 1a. Define reference variables
* 定义关键使用的 ALV 的类 . 和自定义的容器
DATA: G_ALV_TREE TYPE REF TO CL_GUI_ALV_TREE,
G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*定义输出的表结构
DATA: GT_SFLIGHT TYPE SFLIGHT OCCURS 0, "Output-Table
OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM, "OK-Code
G_MAX TYPE I VALUE 255.
END-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module PBO OUTPUT
*&---------------------------------------------------------------------*
* process before output
*----------------------------------------------------------------------*
MODULE PBO OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAINTITLE'.
IF G_ALV_TREE IS INITIAL.