码迷,mamicode.com
首页 > 其他好文 > 详细

FPM八:FPM TREE

时间:2019-09-19 13:49:20      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:_id   ras   get   table   like   接口   select   com   loaded   

先上效果图:

技术图片

 

 

1,新建类:ZCL_FPM_TREE,并添加接口:IF_FPM_GUIBB,IF_FPM_GUIBB_TREE。激活所有方法

2.定义tree结构,在class的public section里添加:

  types:
    "add by ly 20190919 for data structure
    BEGIN OF ty_tree.
            INCLUDE TYPE fpmgb_s_tree_master_column.
    TYPES:
      land1 TYPE land1,
      landx TYPE landx,
      bland TYPE regio,
      bezei TYPE bezei,
      END OF ty_tree .

  data GT_TREE type TABLE OF TY_TREE .
  data GW_TREE TYPE TY_TREE .

3.定义TREE字段目录:在方法GET_DEFINITION中:

  METHOD if_fpm_guibb_tree~get_definition.
    DATA:ls_field TYPE fpmgb_s_treefield_descr.
    eo_field_catalog ?= cl_abap_tabledescr=>describe_by_data( gt_tree ).

    "tree
    ls_field-name = PARENT_KEY.
    ls_field-column_type = if_fpm_guibb_constants=>gc_guibb_tree_columns-parent_key.
    APPEND ls_field TO et_field_description.

    ls_field-name = ROW_KEY.
    ls_field-column_type = if_fpm_guibb_constants=>gc_guibb_tree_columns-row_key.
    APPEND ls_field TO et_field_description.

    ls_field-name = EXPANDED.
    ls_field-column_type = if_fpm_guibb_constants=>gc_guibb_tree_columns-expanded.
    APPEND ls_field TO et_field_description.

    ls_field-name = IS_LEAF.
    ls_field-column_type = if_fpm_guibb_constants=>gc_guibb_tree_columns-is_leaf.
    APPEND ls_field TO et_field_description.

    ls_field-name = TEXT.
    ls_field-column_type = if_fpm_guibb_constants=>gc_guibb_tree_columns-text.
    APPEND ls_field TO et_field_description.

    ls_field-name = CHILDREN_LOADED.
    ls_field-column_type = if_fpm_guibb_constants=>gc_guibb_tree_columns-child_load.
    APPEND ls_field TO et_field_description.

    ls_field-name = IMAGE_SRC.
    ls_field-column_type = if_fpm_guibb_constants=>gc_guibb_tree_columns-img_src.
    APPEND ls_field TO et_field_description.

  ENDMETHOD.

4.在GET_DATA中添加初始化tree结构的内表代码:

  METHOD if_fpm_guibb_tree~get_data.
    DATA:gt_t005t TYPE TABLE OF t005t,
         gw_t005t LIKE LINE OF gt_t005t,
         gt_t005u TYPE TABLE OF t005u,
         gw_t005u LIKE LINE OF gt_t005u.
    IF io_event->mv_event_id = FPM_START.
      SELECT * INTO TABLE gt_t005t FROM t005t WHERE spras = E.
      SELECT * INTO TABLE gt_t005u FROM t005u WHERE spras = E.

      LOOP AT gt_t005t INTO gw_t005t.
        MOVE-CORRESPONDING gw_t005t TO gw_tree.
        gw_tree-row_key = gw_t005t-land1.
        gw_tree-is_leaf = abap_false.
        gw_tree-expanded = abap_false.
        gw_tree-text = gw_t005t-landx.
        APPEND gw_tree TO gt_tree.

      ENDLOOP.

      LOOP AT gt_t005u INTO gw_t005u.
          CLEAR:gw_tree.
          MOVE-CORRESPONDING gw_t005u TO gw_tree.
          gw_tree-row_key = gw_t005u-bland.
          gw_tree-is_leaf = abap_true.
          gw_tree-parent_key = gw_t005u-land1.
          gw_tree-text = gw_t005u-bezei.
          APPEND gw_tree TO gt_tree.
        ENDLOOP.

      ct_data = gt_tree.
      ev_data_changed = X.
    ENDIF.
  ENDMETHOD.

5.打开FPM工作台,点击新建空的FPM程序:

技术图片

6.输入程序名称,选择VOP类型,选择本地包,保存。

技术图片

7.保存之后会出现两个链接的页面,选择编辑配置:

技术图片

8.输入配置描述,进入配置主界面,在UIBB中选择添加TREE类型UIBB。

技术图片

9.输入一个配置编号,回车,然后选择当前行,点击配置UIBB。

技术图片

10.在新开的配置页面中,输入描述,保存。这时候会进入配置UIBB页面,提示输入FEEDER CLASS,输入上面上面创建的类。

技术图片

技术图片

11.在配置列里添加需要展示的字段。保存,测试即可。

技术图片

FPM八:FPM TREE

标签:_id   ras   get   table   like   接口   select   com   loaded   

原文地址:https://www.cnblogs.com/sapSB/p/11548841.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!