RERCS系统开发实战案例-Part05 FPM Application的Feeder Class搜索组件的实施

1、通过事务码 SE24对Feeder Class实施

1)接口页签的简单说明:
① IF_FPM_GUIBB:通用UI构建块,整个UIBB模块的基础接口;

② IF_FPM_GUIBB_SEARCH:通用搜索UI构建块,搜索组件UIBB的基础接口;

③ IF_FPM_GUIBB_LIST:通用列表UI构建块,列表组件UIBB的基础接口;

④ IF_FPM_GUIBB_OVS_SEARCH:FPM搜索:用于相关搜索的特殊OVS接口,用于特殊搜索条件字段扩展(例如搜索帮助引用等);

⑤ IF_FPM_GUIBB_OVS:接口提供回调方法使用OVS(Object Value Selector)与POWL(Personal Object Worklist),添加IF_FPM_GUIBB_OVS_SEARCH时会自动带出该接口,一般是嵌套使用;

备注:IF_FPM_GUIBB_OVS_SEARCH提供GUIBB搜索的搜索条件,IF_FPM_GUIBB_OVS返回搜索条件的结果。

IF_FPM_GUIBB_OVS包括以下四个方法:
HANDLE_PHASE_0:OVS配置,通过调用IF_WD_OVS->set_configuration返回配置的字段;

HANDLE_PHASE_1:OVS初始化字段;

HANDLE_PHASE_2:获取数据,通过调用IF_WD_OVS->set_output_table返回配置字段的结果;

HANDLE_PHASE_3:设置返回值;

2)Feeder Class中的基本方法:在接口页签继承的接口,自然也会把其中的方法继承过来;
备注:后续列表组件List UIBB的FeederClass的实施便是此处的List UIBB的方法

3)搜索组件Search UIBB方法的实施(包括OVS的方法);

①、方法IF_FPM_GUIBB_OVS_SEARCH~SET_CURRENT_SEARCH_CRITERIA:传递当前搜索界面的信息

  METHOD IF_FPM_GUIBB_OVS_SEARCH~SET_CURRENT_SEARCH_CRITERIA.
    MT_SEARCH_CRITERIA = IT_FPM_SEARCH_CRITERIA.
  ENDMETHOD.

②、方法IF_FPM_GUIBB_OVS~HANDLE_PHASE_0:配置OVS返回值字段;

METHOD IF_FPM_GUIBB_OVS~HANDLE_PHASE_0 .
  DATA: LS_COLUNM_TEXT TYPE WDR_NAME_VALUE.
  DATA: LT_COLUNM_TEXT TYPE WDR_NAME_VALUE_LIST.
  DATA: LV_HEADER_TEXT TYPE STRING.

  CASE IV_FIELD_NAME.
    WHEN 'ZJBBM'.
      LV_HEADER_TEXT = '总监部'.
      LS_COLUNM_TEXT-NAME = 'ORGID'.
      LS_COLUNM_TEXT-VALUE = '总监部编码'.
      APPEND LS_COLUNM_TEXT TO LT_COLUNM_TEXT.
      CLEAR LS_COLUNM_TEXT.

      LS_COLUNM_TEXT-NAME = 'ORGNM'.
      LS_COLUNM_TEXT-VALUE = '总监部名称'.
      APPEND LS_COLUNM_TEXT TO LT_COLUNM_TEXT.
      CLEAR LS_COLUNM_TEXT.

      CALL METHOD IO_OVS_CALLBACK->SET_CONFIGURATION
        EXPORTING
          GROUP_HEADER = LV_HEADER_TEXT
          COLUMN_TEXTS = LT_COLUNM_TEXT
          COL_COUNT    = 2
          ROW_COUNT    = 20.

  ENDCASE.
ENDMETHOD.

③、方法IF_FPM_GUIBB_OVS~HANDLE_PHASE_1:

无实施要求,直接激活;

④、方法IF_FPM_GUIBB_OVS~HANDLE_PHASE_2:获取配置字段的值;

METHOD IF_FPM_GUIBB_OVS~HANDLE_PHASE_2 .
  DATA: LV_QYBM TYPE PHINR.
  DATA: LT_ZJB TYPE STANDARD TABLE OF TS_ORG.
  DATA:LT_ZJBBM TYPE TABLE OF ZSJBBM,
       LS_ZJBBM TYPE ZSJBBM.


  CASE IV_FIELD_NAME.
    WHEN 'ZJBBM'.
      READ TABLE MT_SEARCH_CRITERIA ASSIGNING FIELD-SYMBOL(<FS_SEARCH_CRITERIA>) WITH KEY SEARCH_ATTRIBUTE = 'QYBM'.
      IF SY-SUBRC = 0.
        LV_QYBM = <FS_SEARCH_CRITERIA>-LOW.
      ENDIF.

      IF LV_QYBM IS NOT INITIAL.
        DATA(LT_ZJBBM_FIXED_VALUES) = ZRRE_CL_LIB_CCM_UTIL=>GET_ZJB_FIXED_VALUES( IV_QYBM = LV_QYBM ).
        SORT LT_ZJBBM_FIXED_VALUES BY VALUE.
      ENDIF.

      CALL FUNCTION 'ZFM_GET_RCS_AUTH'
        EXPORTING
          IV_OBJECT = 'ZRRE_CONT'
        TABLES
          OT_JBBM   = LT_ZJBBM.

      LOOP AT LT_ZJBBM_FIXED_VALUES ASSIGNING FIELD-SYMBOL(<FS_FIXED_VALUES>).
        READ TABLE LT_ZJBBM INTO DATA(PS_ZJBBM) WITH KEY ID = '*'."* 号直接汇总
        IF SY-SUBRC = 0.
          APPEND INITIAL LINE TO LT_ZJB ASSIGNING FIELD-SYMBOL(<FS_ZJB>).
          <FS_ZJB>-ORGID = <FS_FIXED_VALUES>-VALUE.
          <FS_ZJB>-ORGNM = <FS_FIXED_VALUES>-TEXT.
        ELSE.
          READ TABLE LT_ZJBBM INTO LS_ZJBBM WITH KEY ID = <FS_FIXED_VALUES>-VALUE.
          IF SY-SUBRC = 0."非 * 号按照授权范围汇总
            APPEND INITIAL LINE TO LT_ZJB ASSIGNING FIELD-SYMBOL(<FS_ZJBBM>).
            <FS_ZJBBM>-ORGID = <FS_FIXED_VALUES>-VALUE.
            <FS_ZJBBM>-ORGNM = <FS_FIXED_VALUES>-TEXT.
          ENDIF.
        ENDIF.

      ENDLOOP.
      SORT LT_ZJB BY ORGID.
      CALL METHOD IO_OVS_CALLBACK->SET_OUTPUT_TABLE
        EXPORTING
          OUTPUT = LT_ZJB.
  ENDCASE.
ENDMETHOD.

⑤、方法IF_FPM_GUIBB_OVS~HANDLE_PHASE_3:设置返回值;

METHOD IF_FPM_GUIBB_OVS~HANDLE_PHASE_3 .
  FIELD-SYMBOLS: <FS_ZJB> TYPE TS_ORG.
  DATA: LO_FPM TYPE REF TO IF_FPM.

  LO_FPM ?= CL_FPM_FACTORY=>GET_INSTANCE( ).
  CASE IV_FIELD_NAME.
    WHEN 'ZJBBM'.
      ASSIGN IO_OVS_CALLBACK->SELECTION->* TO <FS_ZJB> .
      IF <FS_ZJB> IS ASSIGNED.
        CALL METHOD IO_OVS_CALLBACK->CONTEXT_ELEMENT->SET_ATTRIBUTE(
            NAME  = IO_OVS_CALLBACK->CONTEXT_ATTRIBUTE
            VALUE = <FS_ZJB>-ORGID ).
        CREATE OBJECT EO_FPM_EVENT
          EXPORTING
            IV_EVENT_ID = 'HANDLE_ENTERED'.
      ENDIF.
  ENDCASE.
ENDMETHOD.

⑥、方法IF_FPM_GUIBB~INITIALIZE:初始化UIBB页面,根据BOPF的常量接口的SC_BO_KEY指定BO对象

METHOD IF_FPM_GUIBB~INITIALIZE.
    MO_FPM ?= CL_FPM_FACTORY=>GET_INSTANCE( ).
    MO_SRV_MGR = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( ZRRE_IF_YSYFBL_C=>SC_BO_KEY ).
  ENDMETHOD.

⑦、方法IF_FPM_GUIBB~GET_PARAMETER_LIST:获取表单提供程序支持的参数列表;

无实施需求,直接激活。

⑧、方法IF_FPM_GUIBB_SEARCH~GET_DEFINITION:搜索条件字段引用搜索帮助等;

 DATA: LT_ENUMERATION TYPE FPMGB_T_NAMEVALUE,
          LT_FIXED_VALUE TYPE WDR_CONTEXT_ATTR_VALUE_LIST.
    EO_FIELD_CATALOG_ATTR ?= CL_ABAP_TABLEDESCR=>DESCRIBE_BY_NAME( 'ZRRE_S_BO_YSYFBL_ROOT_C' ).

    APPEND VALUE #( NAME = 'PRJID' DDIC_SHLP_NAME = 'ZRRE_H_PRJ' ) TO ET_FIELD_DESCRIPTION_ATTR.
    APPEND VALUE #( NAME = 'LIFNR' DDIC_SHLP_NAME = 'ZRRE_H_BP' ) TO ET_FIELD_DESCRIPTION_ATTR.

    CLEAR:LT_FIXED_VALUE,LT_ENUMERATION.
    LT_FIXED_VALUE = ZRRE_CL_LIB_CCM_UTIL=>GET_QY3_FIXED_VALUES( ).
    LT_ENUMERATION  = CORRESPONDING #( LT_FIXED_VALUE MAPPING NAME = TEXT ).
    APPEND VALUE #( NAME = 'QYBM' ENUMERATION = LT_ENUMERATION MAX_1_VALUE = ABAP_FALSE ) TO ET_FIELD_DESCRIPTION_ATTR.

    APPEND VALUE #( NAME = 'ZJBBM' OVS_NAME  = 'ZRRE_CL_FD_YSYFBL_SEARCH' MAX_1_VALUE = ABAP_FALSE ) TO ET_FIELD_DESCRIPTION_ATTR.

⑨方法IF_FPM_GUIBB_SEARCH~GET_DATA:发起SEARCH操作事件,用于搜索条件下一步获取数据;

 METHOD IF_FPM_GUIBB_SEARCH~GET_DATA.
    DATA: LO_SRV_MGR TYPE REF TO /BOBF/IF_TRA_SERVICE_MANAGER,
          LO_FPM     TYPE REF TO IF_FPM.
    DATA: LT_SELECTION_PARAMETERS TYPE /BOBF/T_FRW_QUERY_SELPARAM,
          LS_SELECTION_PARAMETERS TYPE /BOBF/S_FRW_QUERY_SELPARAM,
          LS_QUERY_OPTIONS        TYPE /BOBF/S_FRW_QUERY_OPTIONS.
    DATA CORE_OBJECT TYPE REF TO /BOBF/IF_TRA_SERVICE_MANAGER .
    DATA: LS_RSDS TYPE RSDSSELOPT.
    DATA: LV_AUTH TYPE BOOLEAN.
    DATA:LT_JBBM           TYPE TABLE OF ZSJBBM,
         LS_JBBM           TYPE ZSJBBM,
         LS_MESSAGES       TYPE FPMGB_SEARCH_S_T100_MESSAGE,
         LS_QUERY_SELPARAM TYPE /BOBF/S_FRW_QUERY_SELPARAM,
         LV_MSG            TYPE STRING.

    LO_FPM ?= CL_FPM_FACTORY=>GET_INSTANCE( ).
    LO_SRV_MGR = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( ZRRE_IF_YSYFBL_C=>SC_BO_KEY ).

    CASE IO_EVENT->MV_EVENT_ID.
      WHEN 'FPM_EXECUTE_SEARCH'.

        LOOP AT CT_FPM_SEARCH_CRITERIA ASSIGNING FIELD-SYMBOL(<FS_FPM_SEARCH>) WHERE LOW IS NOT INITIAL.

          LS_SELECTION_PARAMETERS-ATTRIBUTE_NAME = <FS_FPM_SEARCH>-SEARCH_ATTRIBUTE.
          TRY.
              LS_RSDS = CL_FPM_GUIBB_SEARCH_CONVERSION=>TO_ABAP_SELECT_OPTION( IS_FPM_SEARCH_ROW = <FS_FPM_SEARCH> ).
            CATCH CX_FPMGB.
              CONTINUE.
          ENDTRY.
          LS_SELECTION_PARAMETERS-SIGN = LS_RSDS-SIGN.
          LS_SELECTION_PARAMETERS-OPTION = LS_RSDS-OPTION.
          LS_SELECTION_PARAMETERS-LOW = LS_RSDS-LOW.
          LS_SELECTION_PARAMETERS-HIGH = LS_RSDS-HIGH.
          APPEND LS_SELECTION_PARAMETERS TO LT_SELECTION_PARAMETERS.
          CLEAR  LS_SELECTION_PARAMETERS.
        ENDLOOP.

        IF MV_MAXLINES IS NOT INITIAL.
          LS_QUERY_OPTIONS-MAXIMUM_ROWS = MV_MAXLINES.
        ENDIF.

        "不输入总监部情况下 获取权限内所有总监部
        READ TABLE LT_SELECTION_PARAMETERS INTO DATA(LS_SEL) WITH KEY ATTRIBUTE_NAME = 'ZJBBM'.
        IF SY-SUBRC <> 0.
          CALL FUNCTION 'ZFM_GET_RCS_AUTH'
            EXPORTING
              IV_OBJECT = 'ZRRE_CONT'
            TABLES
              OT_JBBM   = LT_JBBM.

          IF LT_JBBM[] IS INITIAL.
            MESSAGE E237(/RER/CO) INTO LV_MSG.
            LS_MESSAGES-MSGID = SY-MSGID.
            LS_MESSAGES-MSGNO = SY-MSGNO.
            LS_MESSAGES-SEVERITY = 'E'.
            APPEND LS_MESSAGES TO ET_MESSAGES.
            RETURN.
          ENDIF.

          READ TABLE LT_JBBM INTO DATA(PS_JBBM) WITH KEY ID = '*'.
          IF SY-SUBRC <> 0.
            LOOP AT LT_JBBM INTO LS_JBBM WHERE ID <> '*'.
              LS_QUERY_SELPARAM-ATTRIBUTE_NAME ='ZJBBM'.
              LS_QUERY_SELPARAM-SIGN = 'I'.
              LS_QUERY_SELPARAM-OPTION = 'EQ'.
              LS_QUERY_SELPARAM-LOW = LS_JBBM-ID.
              APPEND LS_QUERY_SELPARAM TO LT_SELECTION_PARAMETERS.
            ENDLOOP.
          ENDIF.
        ENDIF.

        LO_SRV_MGR->QUERY(
        EXPORTING
        IV_QUERY_KEY = ZRRE_IF_YSYFBL_C=>SC_QUERY-ROOT-SELECT_BY_ATTRS
        IT_SELECTION_PARAMETERS = LT_SELECTION_PARAMETERS
        IS_QUERY_OPTIONS = LS_QUERY_OPTIONS
        IV_FILL_DATA     = ABAP_TRUE
        IMPORTING
          ET_DATA = MT_RESULT ).

        IF MT_RESULT[] IS INITIAL.
          MESSAGE E229(/RER/CO) INTO LV_MSG.
          LS_MESSAGES-MSGID = SY-MSGID.
          LS_MESSAGES-MSGNO = SY-MSGNO.
          LS_MESSAGES-SEVERITY = 'E'.
          APPEND LS_MESSAGES TO ET_MESSAGES.
          RETURN.
        ENDIF.

        CALL METHOD LO_FPM->RAISE_EVENT_BY_ID
          EXPORTING
            IV_EVENT_ID = 'REFRESH'.

    ENDCASE.
  ENDMETHOD.

其他无实施需求方法不再一一列举了。

到此,Search UIBB对应Feeder Class的基本实施已完成。

相关推荐
lu_rong_qq3 天前
SAP B1 登陆报错解决方案 - 系统架构目录服务器选择
sap
斌将军4 天前
BP新增页签增强
abap
LilySesy6 天前
SAP+Internet主题HTML样式选择
前端·html·sap·abap·internet服务·its·扫码枪
SAP学习成长之路6 天前
如何在SM30生成的维护表中增加选择框 CheckBox
开发语言·数据库·sap·健康医疗·abap·代码规范
SAPABAP东芝9 天前
【SAP-ABAP】MIRO--界面增强增加数据导出导入按钮
sap·abap·fico
cyqweqe1239 天前
SAP采购发票税额总额非自动计算。TAX不写行号
abap
SAP学习成长之路10 天前
【翻译】伯明翰市议会因 Oracle 系统崩溃而面临 £216.5M 的损失
数据库·oracle·sap
乐乐823412 天前
ABAP:SET CURSOR FIELD设置鼠标焦点
abap
向上的车轮12 天前
ODOO学习笔记(4):Odoo与SAP的主要区别是什么?
笔记·学习·sap·odoo
哲讯智能科技14 天前
SAP Business One市场价格解析
运维·sap·erp