SAP ABAP/4学习--BCALV_TREE_01分析

BCALV_TREE_01分析

                                SSOLE

 

 

 

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.

*初期化这个树

    PERFORM INIT_TREE.

 

    CALL METHOD CL_GUI_CFW=>FLUSH

      EXCEPTIONS

        CNTL_SYSTEM_ERROR = 1

        CNTL_ERROR        = 2.

    IF SY-SUBRC NE 0.

      CALL FUNCTION 'POPUP_TO_INFORM'

        EXPORTING

          TITEL = 'Automation Queue failure'(801)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值