先上效果圖:測試
1,新建類:ZCL_FPM_TREE,並添加接口:IF_FPM_GUIBB,IF_FPM_GUIBB_TREE。激活全部方法ui
2.定義tree結構,在class的public section裏添加:spa
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中:code
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結構的內表代碼:blog
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類型,選擇本地包,保存。ip
7.保存以後會出現兩個連接的頁面,選擇編輯配置:get
8.輸入配置描述,進入配置主界面,在UIBB中選擇添加TREE類型UIBB。it
9.輸入一個配置編號,回車,而後選擇當前行,點擊配置UIBB。io
10.在新開的配置頁面中,輸入描述,保存。這時候會進入配置UIBB頁面,提示輸入FEEDER CLASS,輸入上面上面建立的類。
11.在配置列裏添加須要展現的字段。保存,測試便可。