RERCS系统开发实战案例-Part07 FPM Application的Feeder Class列表组件(List UIBB)的实施

Feeder Class列表组件(List UIBB)的实施

1)此处涉及到新增按钮事件,先介绍一下新增按钮步骤:
按钮选择:是指多个按钮组成的下拉框菜单;

按钮:只是一个简单的按钮
2)以下是IF_FPM_GUIBB_LIST中各个方法的实施源码,仅供参考(仅记录有实施需求的方法):

① 方法IF_FPM_GUIBB_LIST~PROCESS_EVENT:创建按钮等事件活动;

METHOD IF_FPM_GUIBB_LIST~PROCESS_EVENT.
    DATA: LO_FPM TYPE REF TO IF_FPM.
    DATA: LT_APP_PARAMS TYPE APB_LPD_T_PARAMS,
          LS_APP_PARAM  LIKE LINE OF LT_APP_PARAMS[].

    DATA: LS_DIALOG_BOX_PROPERTIES TYPE FPM_S_DIALOG_BOX_PROPERTIES.
    LO_FPM ?= CL_FPM_FACTORY=>GET_INSTANCE( ).

    CASE IO_EVENT->MV_EVENT_ID .
      WHEN  'BTN_CREATE'.

        LS_APP_PARAM-KEY = /RER/IF_CONSTANTS=>GC_APP_PARAM-CHANGE_MODE.
        LS_APP_PARAM-VALUE = 'C'.
        APPEND LS_APP_PARAM TO LT_APP_PARAMS[].

        LS_APP_PARAM-KEY = IF_FPM_CONSTANTS=>GC_APP_PARAMS-EDIT_MODE.
        LS_APP_PARAM-VALUE = 'E'.
        APPEND LS_APP_PARAM TO LT_APP_PARAMS[].

        /RER/CL_LIB_CCM_UTIL=>NAVIGATE_VIA_LPD(
          IV_APP_ALIAS  = 'CREATE_YSYFBL'
          IT_APP_PARAMS = LT_APP_PARAMS[] ).

      WHEN 'FPM_GUIBB_LIST_CELL_ACTION'.
        READ TABLE MT_RESULT ASSIGNING FIELD-SYMBOL(<FS_RESL>) INDEX IV_LEAD_INDEX.
        IF SY-SUBRC = 0.

          LS_APP_PARAM-KEY = /RER/IF_CONSTANTS=>GC_APP_PARAM-KEY.
          LS_APP_PARAM-VALUE = <FS_RESL>-KEY.
          APPEND LS_APP_PARAM TO LT_APP_PARAMS[].

          LS_APP_PARAM-KEY = /RER/IF_CONSTANTS=>GC_APP_PARAM-SKIP_INITIAL_SCREEN.
          LS_APP_PARAM-VALUE = ABAP_TRUE.
          APPEND LS_APP_PARAM TO LT_APP_PARAMS[].

          LS_APP_PARAM-KEY = IF_FPM_CONSTANTS=>GC_APP_PARAMS-EDIT_MODE.
          LS_APP_PARAM-VALUE = 'R'.
          APPEND LS_APP_PARAM TO LT_APP_PARAMS[].

          /RER/CL_LIB_CCM_UTIL=>NAVIGATE_VIA_LPD(
            IV_APP_ALIAS  = 'CREATE_YSYFBL'
            IT_APP_PARAMS = LT_APP_PARAMS[] ).

        ENDIF.
    ENDCASE.
  ENDMETHOD.

②方法IF_FPM_GUIBB_LIST~GET_DATA:获取数据, 此处直接通过方法IF_FPM_GUIBB_SEARCH~GET_DATA获取的数据通过参数传值;

  METHOD IF_FPM_GUIBB_LIST~GET_DATA.
    CT_DATA = MT_RESULT.
    EV_FIELD_USAGE_CHANGED = ABAP_TRUE.
    EV_DATA_CHANGED = ABAP_TRUE.
  ENDMETHOD.

③ 方法IF_FPM_GUIBB_LIST~GET_DEFINITION:列表结构字段定义搜索帮助与及按钮名称定义;

DATA: LS_FIELD_DESCR TYPE        FPMGB_S_LISTFIELD_DESCR,
          LO_STRUCTDESCR TYPE REF TO CL_ABAP_STRUCTDESCR,
          LT_COMPONENT   TYPE        ABAP_COMPONENT_TAB.

    FIELD-SYMBOLS:  <FS_COMPONENT> LIKE LINE OF LT_COMPONENT.
    DATA: LT_FIXED_VALUES TYPE WDR_CONTEXT_ATTR_VALUE_LIST.

    EO_FIELD_CATALOG ?= CL_ABAP_TABLEDESCR=>DESCRIBE_BY_NAME( 'ZRRE_T_BO_YSYFBL_ROOT_C' ).
    LO_STRUCTDESCR ?= CL_ABAP_TABLEDESCR=>DESCRIBE_BY_NAME( 'ZRRE_S_BO_YSYFBL_ROOT_C' ).
*    lt_component = lo_structdescr->get_components( ).

    DATA(LT_FIELD_LIST) =  LO_STRUCTDESCR->GET_DDIC_FIELD_LIST( P_LANGU = SY-LANGU P_INCLUDING_SUBSTRUCTRES = 'X' ).
    LOOP AT LT_FIELD_LIST ASSIGNING FIELD-SYMBOL(<FS_FIELD_LIST>).
      LS_FIELD_DESCR-NAME = <FS_FIELD_LIST>-FIELDNAME.
      LS_FIELD_DESCR-ALLOW_FILTER = ABAP_TRUE.
      LS_FIELD_DESCR-ALLOW_AGGREGATION = ABAP_TRUE.
      LS_FIELD_DESCR-ALLOW_SORT = ABAP_TRUE.
      LS_FIELD_DESCR-VISIBILITY = CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE.

      APPEND LS_FIELD_DESCR TO ET_FIELD_DESCRIPTION.
      CLEAR LS_FIELD_DESCR.
    ENDLOOP.

    "列表字段显示文本
    CLEAR LS_FIELD_DESCR.
    LT_FIXED_VALUES = ZRRE_CL_LIB_CCM_UTIL=>GET_QY3_FIXED_VALUES( ).
    APPEND VALUE #( NAME = 'QYBM' FIXED_VALUES = LT_FIXED_VALUES ) TO ET_FIELD_DESCRIPTION.

    CLEAR LS_FIELD_DESCR.
    LT_FIXED_VALUES = ZRRE_CL_LIB_CCM_UTIL=>GET_ZJB_FIXED_VALUES(  ).
    APPEND VALUE #( NAME = 'ZJBBM' FIXED_VALUES = LT_FIXED_VALUES ) TO ET_FIELD_DESCRIPTION.

    "自定义按钮扩展
    APPEND VALUE #( ID = 'BTN_CREATE' ENABLED = ABAP_TRUE ) TO ET_ACTION_DEFINITION.
*    APPEND VALUE #( ID = 'BTN_CRT_02' ENABLED = ABAP_TRUE ) TO ET_ACTION_DEFINITION.

*---Shared dictionary------------------------------------------------
    DATA: LV_CONFIG_ID TYPE        WDY_CONFIG_ID,
          LO_DIC       TYPE REF TO /RER/CL_SHARED_DIC.
    DATA: LO_FPM TYPE REF TO IF_FPM.
    IF LO_FPM IS INITIAL.
      LO_FPM ?= CL_FPM_FACTORY=>GET_INSTANCE( ).
    ENDIF.
    IF LO_FPM IS NOT INITIAL.
      CALL METHOD LO_FPM->MO_APP_PARAMETER->GET_VALUE
        EXPORTING
          IV_KEY   = /RER/IF_CCM_CONSTANTS=>GC_WD_CONFIGID "'SAP-WD-CONFIGID'
        IMPORTING
          EV_VALUE = LV_CONFIG_ID.

      CREATE OBJECT LO_DIC EXPORTING IV_CONFIG_ID = LV_CONFIG_ID .
      .
      IF LO_DIC IS NOT INITIAL.
        CALL METHOD LO_DIC->CHG_DEF
          CHANGING
            CT_ACT      = ET_ACTION_DEFINITION
            CT_LIST_FLD = ET_FIELD_DESCRIPTION.
      ENDIF.
    ENDIF.

该方法是对于List UIBB整个页面的按钮,字段等页面属性的设置,应用较广泛。

相关推荐
山茶花开时。7 天前
[SAP ABAP] 序列化与反序列化
开发语言·sap·abap
左甜甜9 天前
SAP MMPV报错MMPV_DATE_CHECK
sap
SAP女战士11 天前
【ABAP SAP】开发-BUG修补记录_采购申请打印时品名规格品牌为空
运维·数据库·bug·sap·abap开发
Cindy的SAP加油站14 天前
SAP Ariba_Order Fulfillment Status
sap·sap ariba
SAP学习成长之路14 天前
ADBC 查询语法介绍:EXECUTE_QUERY
java·服务器·开发语言·数据库·sap·abap·零售
需己以听的以听16 天前
4.模块化技术之子程序
sap·gui·abap·模块化·改行学it·子程序
syounger16 天前
近四分之一SAP ECC用户对未来规划尚不明朗
sap
HeathlX18 天前
ABAP - 系统集成之SAP的数据同步到OA(泛微E9)服务器数据库
数据库·abap
SAP学习成长之路21 天前
SAP HANA 上进行 ABAP 开发:简介
开发语言·数据结构·数据库·sap·abap·代码规范
Fireworks_me23 天前
SAP Native SQL 的简单说明
sql·abap