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整个页面的按钮,字段等页面属性的设置,应用较广泛。

相关推荐
SAPABAP东芝2 天前
【SAP-ABAP】MIRO--界面增强增加数据导出导入按钮
sap·abap·fico
cyqweqe1232 天前
SAP采购发票税额总额非自动计算。TAX不写行号
abap
SAP学习成长之路2 天前
【翻译】伯明翰市议会因 Oracle 系统崩溃而面临 £216.5M 的损失
数据库·oracle·sap
乐乐82345 天前
ABAP:SET CURSOR FIELD设置鼠标焦点
abap
向上的车轮5 天前
ODOO学习笔记(4):Odoo与SAP的主要区别是什么?
笔记·学习·sap·odoo
哲讯智能科技6 天前
SAP Business One市场价格解析
运维·sap·erp
小九不懂SAP10 天前
SAP(PP生产制造)拆解工单业务处理
sap·制造·s4·pp
冰魄禾12 天前
SAP ABAP开发学习——BAPI
运维·开发语言·笔记·运维开发·sap·abap
syounger15 天前
是我们“辜负”了IBM、SAP么?
sap
Liquid UI16 天前
Amcor 如何借助 Liquid UI 实现SAP PM可靠性
ui·自动化·sap·制造