RERCS系统-WDA+BOPF框架实战例子 PART 3-Feeder Class 方法处理与解释

本文主要是介绍RERCS系统-WDA+BOPF框架实战例子 PART 3-Feeder Class 方法处理与解释,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

涉及到的相关类:1)List UIBB对应的Feeder Class 2)BOPF对应的Determination的实施类

1、SE24把新建的Feeder Class类进行主要处理,List UIBB的Feeder Class参照超类:/BOFU/CL_FBI_GUIBB_LIST;
在这里插入图片描述
接口页签自动带出继承的接口,方法页签自动带出继承的方法;
在这里插入图片描述在这里插入图片描述
对应Feeder Class几个方法的说明:
1)IF_FPM_GUIBB~INITIALIZE:初始化页面数据,获取服务前端页面数据。

  METHOD IF_FPM_GUIBB~INITIALIZE.CALL METHOD SUPER->IF_FPM_GUIBB~INITIALIZEEXPORTINGIT_PARAMETER      = IT_PARAMETERIO_APP_PARAMETER  = IO_APP_PARAMETERIV_COMPONENT_NAME = IV_COMPONENT_NAMEIS_CONFIG_KEY     = IS_CONFIG_KEYIV_INSTANCE_ID    = IV_INSTANCE_ID.MO_FPM ?= CL_FPM_FACTORY=>GET_INSTANCE( ).ENDMETHOD.

2)IF_FPM_GUIBB_LIST~PROCESS_EVENT:页面按钮等触发型的动作事件。

  METHOD IF_FPM_GUIBB_LIST~PROCESS_EVENT.
*CALL METHOD SUPER->IF_FPM_GUIBB_LIST~PROCESS_EVENT
*  EXPORTING
*    IO_EVENT            = IO_EVENT
**    IV_RAISED_BY_OWN_UI = IV_RAISED_BY_OWN_UI
*    IV_LEAD_INDEX       = IV_LEAD_INDEX
*    IV_EVENT_INDEX      = IV_EVENT_INDEX
*    IT_SELECTED_LINES   = IT_SELECTED_LINES
**    IO_UI_INFO          = IO_UI_INFO
**  IMPORTING
**    EV_RESULT           = EV_RESULT
**    ET_MESSAGES         = ET_MESSAGES
*    .DATA:LO_ENTITY_COLLECTION TYPE REF TO  /BOFU/IF_FBI_ENTITY_COLLECTION,LS_SELECTED_LINE     LIKE LINE OF IT_SELECTED_LINES,LT_SELECTED_LINES    LIKE         IT_SELECTED_LINES,LR_TABLE_DESCR       TYPE REF TO  CL_ABAP_TABLEDESCR,LR_DATA_DESCR        TYPE REF TO  CL_ABAP_DATADESCR,LV_TAB_KEYS          TYPE         ABAP_TABLE_KEYDESCR_TAB,LR_DATA_STRUC        TYPE REF TO  DATA,LR_VALUE             TYPE REF TO  DATA,LT_KEYS              TYPE         /BOBF/T_FRW_KEY.FIELD-SYMBOLS:<FT_DATA> TYPE INDEX TABLE,<FS_DATA> TYPE              DATA,<FV_KEY>  TYPE              /BOBF/CONF_KEY.LR_TABLE_DESCR ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA_REF( P_DATA_REF = MT_DATA ).LR_DATA_DESCR = LR_TABLE_DESCR->GET_TABLE_LINE_TYPE( ).CREATE DATA LR_DATA_STRUC TYPE HANDLE LR_DATA_DESCR.ASSIGN LR_DATA_STRUC->* TO <FS_DATA>.ASSIGN MT_DATA->* TO <FT_DATA>.IF IO_EVENT->MV_EVENT_ID EQ CL_FPM_EVENT=>GC_EVENT_LEAVE_INITIAL_SCREEN.
*      fill_select_line_on_leave_scrn(
*        EXPORTING
*          io_event      =   io_event  " CL_FPM_EVENT
*          iv_lead_index =   iv_lead_index  " Index of Internal Tables
*      ).ENDIF.IO_EVENT->MO_EVENT_DATA->GET_VALUE(EXPORTINGIV_KEY   = /BOFU/IF_FBI_RUNTIME_C=>SC_EVENT_PARAMETERS-COMMON_PARAMS-ACT_CONF_KEYIMPORTINGER_VALUE = LR_VALUE ).
*The action is a BO actionIF  LR_VALUE IS NOT INITIAL.
*Filter out the rows that correspond to empty keysLOOP AT IT_SELECTED_LINES INTO LS_SELECTED_LINE.READ TABLE <FT_DATA> INTO <FS_DATA> INDEX LS_SELECTED_LINE-TABIX.ASSIGN COMPONENT 'KEY' OF STRUCTURE <FS_DATA> TO <FV_KEY>.READ TABLE MT_EMPTY_KEYS WITH TABLE KEY KEY = <FV_KEY> TRANSPORTING NO FIELDS.IF SY-SUBRC <> 0.INSERT LS_SELECTED_LINE INTO TABLE LT_SELECTED_LINES.ENDIF.ENDLOOP.
*      mv_is_filtered = abap_true.PROCESS_EVENT(EXPORTINGIO_EVENT            = IO_EVENTIV_RAISED_BY_OWN_UI = IV_RAISED_BY_OWN_UIIT_SELECTED_LINES   = LT_SELECTED_LINESIT_DATA             = MT_DATAIMPORTINGEV_RESULT           = EV_RESULT).ELSE.
*      mv_is_filtered = abap_false.PROCESS_EVENT(EXPORTINGIO_EVENT            = IO_EVENTIV_RAISED_BY_OWN_UI = IV_RAISED_BY_OWN_UIIT_SELECTED_LINES   = IT_SELECTED_LINESIT_DATA             = MT_DATAIMPORTINGEV_RESULT           = EV_RESULT).ENDIF.
* Return messages
*--------------------------------------------------------------------*
* Messages dispatched in process event doesn't get highlightedIF MS_DEFAULTS-MSGS_IN_PE = ABAP_TRUE.GET_MESSAGES(EXPORTINGIT_DATA     = MT_DATAIMPORTINGET_MESSAGES = ET_MESSAGES).ENDIF.*    DATA: LV_AMT      TYPE /RER/AMT,
*          LS_TAX      TYPE /RER/S_BO_CONT_TAX_C,
*          LS_MESSAGES TYPE FPMGB_S_T100_MESSAGE.CASE IO_EVENT->MV_EVENT_ID.WHEN 'FPM_SAVE'.
*        IF <ft_data> IS NOT INITIAL.
*          CLEAR lv_amt.
*          LOOP AT <ft_data> ASSIGNING <fs_data>.
*            MOVE-CORRESPONDING <fs_data> TO ls_tax.
*            lv_amt = lv_amt + ls_tax-amt_intax.
*          ENDLOOP.
*
*          IF lv_amt <> /rer/cl_cont_toolbar=>ms_root-conamt.
*            ls_messages-msgid = '/RER/CO'.
*            ls_messages-msgno = '449'.
*            ls_messages-severity = 'W'.
*            APPEND ls_messages TO et_messages.
*            IF 1 = 2.
*              MESSAGE s449(yrre_co).
*            ENDIF.
*          ENDIF.
*        ENDIF.ENDCASE.ENDMETHOD.

3)IF_FPM_GUIBB_LIST~GET_DATA:获取数据,此处触发bopf去获取数据库表数据。

  METHOD IF_FPM_GUIBB_LIST~GET_DATA.GET_DATA(EXPORTINGIV_EVENTID                = IV_EVENTID    " ID of the FPM EventIT_SELECTED_FIELDS        = IT_SELECTED_FIELDS    " Selected(Used) FieldsIV_RAISED_BY_OWN_UI       = IV_RAISED_BY_OWN_UI    " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')IV_VISIBLE_ROWS           = IV_VISIBLE_ROWSIV_EDIT_MODE              = IV_EDIT_MODE    " FPM: Edit ModeIO_EXTENDED_CTRL          = IO_EXTENDED_CTRL    " Provides extended List ATS specific configuration optionsIMPORTINGET_MESSAGES               = ET_MESSAGES    " FPMGB Messages (T100 & Plaintext)EV_DATA_CHANGED           = EV_DATA_CHANGED    " Boolean Variable (X=True, -=False, Space=Unknown)EV_FIELD_USAGE_CHANGED    = EV_FIELD_USAGE_CHANGED    " Boolean Variable (X=True, -=False, Space=Unknown)EV_ACTION_USAGE_CHANGED   = EV_ACTION_USAGE_CHANGED    " Boolean Variable (X=True, -=False, Space=Unknown)EV_SELECTED_LINES_CHANGED = EV_SELECTED_LINES_CHANGED    " Boolean Variable (X=True, -=False, Space=Unknown)EV_DND_ATTR_CHANGED       = EV_DND_ATTR_CHANGED    " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')EO_ITAB_CHANGE_LOG        = EO_ITAB_CHANGE_LOG    " Change log for internal tablesCHANGINGCT_DATA                   = CT_DATACT_FIELD_USAGE            = CT_FIELD_USAGE    " Field UsageCT_ACTION_USAGE           = CT_ACTION_USAGE    " Action DefinitionCT_SELECTED_LINES         = CT_SELECTED_LINES    " Repository Infosystem: TabixCV_LEAD_INDEX             = CV_LEAD_INDEX    " Index of Internal TablesCV_FIRST_VISIBLE_ROW      = CV_FIRST_VISIBLE_ROWCS_ADDITIONAL_INFO        = CS_ADDITIONAL_INFO    " Additinal info on the GUIBB tableCT_DND_ATTRIBUTES         = CT_DND_ATTRIBUTES    " Drag and Drop Attributes Definition).DATA: LO_FPM     TYPE REF TO IF_FPM,LO_SRV_MGR TYPE REF TO /BOBF/IF_TRA_SERVICE_MANAGER,LO_MESSAGE TYPE REF TO /BOBF/IF_FRW_MESSAGE,LO_CHANGE  TYPE REF TO /BOBF/IF_TRA_CHANGE.DATA: LT_MODIFY     TYPE /BOBF/T_FRW_MODIFICATION,LS_MODIFY     TYPE /BOBF/S_FRW_MODIFICATION,LT_KEY        TYPE /BOBF/T_FRW_KEY,LS_KEY        TYPE /BOBF/S_FRW_KEY,LV_UG_REF_KEY TYPE /BOBF/CONF_KEY,LV_XMJD       TYPE ZRRE_XMJD,LT_MESSAGE    TYPE /BOBF/T_FRW_MESSAGE_K,LS_MESSAGE    TYPE /BOBF/S_FRW_MESSAGE_K.FIELD-SYMBOLS:<FS_LHTDW> TYPE ZRRE_S_GCLX_LHTDW.DATA:LT_LHTDW TYPE ZRRE_T_GCLX_LHTDW,LR_LHTDW TYPE REF TO DATA.DATA:LT_SORT TYPE ABAP_SORTORDER_TAB.DATA: LV_CHANGE_MODE TYPE    CHAR1,LV_IS_JGC      TYPE CHAR1.FIELD-SYMBOLS: <FT_DATA> TYPE STANDARD TABLE,<FS_KEY>  TYPE /BOBF/CONF_KEY,<FS_DATA> TYPE ANY.ASSIGN CT_DATA TO <FT_DATA>."列表数据存至临时动态内表 <FT_DATA>MOVE-CORRESPONDING ZRRE_CL_FD_PROJ_ROOT=>MS_ROOT TO MS_ROOT.LO_FPM     ?= CL_FPM_FACTORY=>GET_INSTANCE( ).LO_SRV_MGR = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( ZRRE_IF_PROJ_CONSTANTS=>SC_BO_KEY ).CALL METHOD LO_FPM->MO_APP_PARAMETER->GET_VALUEEXPORTINGIV_KEY   = 'XMJD'IMPORTINGEV_VALUE = LV_XMJD.CASE IV_EVENTID->MV_EVENT_ID.WHEN  CL_FPM_EVENT=>GC_EVENT_LEAVE_INITIAL_SCREEN.IF LV_XMJD = '05' AND IV_EDIT_MODE = 'E'."工程立项-调整CALL METHOD LO_FPM->MO_APP_PARAMETER->GET_VALUEEXPORTINGIV_KEY   = 'XM_UG_REF_KEY'IMPORTINGEV_VALUE = LV_UG_REF_KEY. "原工程立项的DB_KEYAPPEND VALUE #( KEY = LV_UG_REF_KEY ) TO LT_KEY.CALL METHOD LO_SRV_MGR->RETRIEVE_BY_ASSOCIATIONEXPORTINGIV_NODE_KEY    = ZRRE_IF_PROJ_CONSTANTS=>SC_NODE-ROOTIT_KEY         = LT_KEYIV_ASSOCIATION = ZRRE_IF_PROJ_CONSTANTS=>SC_ASSOCIATION-ROOT-GCLX_LHTDWIV_FILL_DATA   = ABAP_TRUEIMPORTINGET_DATA        = LT_LHTDW.CLEAR:LT_MODIFY.IF LT_LHTDW IS NOT INITIAL AND <FT_DATA> IS INITIAL.LOOP AT LT_LHTDW INTO DATA(LS_LHTDW).CREATE DATA LR_LHTDW TYPE ZRRE_S_GCLX_LHTDW.ASSIGN LR_LHTDW->* TO <FS_LHTDW>.<FS_LHTDW>-KEY = /BOBF/CL_FRW_FACTORY=>GET_NEW_KEY( ).<FS_LHTDW>-ROOT_KEY = MS_ROOT-KEY.<FS_LHTDW>-PARENT_KEY = MS_ROOT-KEY.<FS_LHTDW>-ZLHTDW_ID = LS_LHTDW-ZLHTDW_ID.<FS_LHTDW>-ZLHTDW_NAME = LS_LHTDW-ZLHTDW_NAME.<FS_LHTDW>-ZNOTE = LS_LHTDW-ZNOTE.<FS_LHTDW>-CREA_UNAME = LS_LHTDW-CREA_UNAME.<FS_LHTDW>-CREA_DATE = LS_LHTDW-CREA_DATE.<FS_LHTDW>-CREA_TIME = LS_LHTDW-CREA_TIME.<FS_LHTDW>-UPDATE_UNAME = LS_LHTDW-UPDATE_UNAME.<FS_LHTDW>-UPDATE_DATE = LS_LHTDW-UPDATE_DATE.<FS_LHTDW>-UPDATE_TIME = LS_LHTDW-UPDATE_TIME.APPEND <FS_LHTDW> TO <FT_DATA>.LS_MODIFY-KEY = <FS_LHTDW>-KEY.LS_MODIFY-NODE = ZRRE_IF_PROJ_CONSTANTS=>SC_NODE-GCLX_LHTDW.LS_MODIFY-CHANGE_MODE = /BOBF/IF_FRW_C=>SC_MODIFY_CREATE.LS_MODIFY-ROOT_KEY = <FS_LHTDW>-PARENT_KEY.LS_MODIFY-SOURCE_KEY = <FS_LHTDW>-PARENT_KEY.LS_MODIFY-SOURCE_NODE = ZRRE_IF_PROJ_CONSTANTS=>SC_NODE-ROOT.LS_MODIFY-ASSOCIATION = ZRRE_IF_PROJ_CONSTANTS=>SC_ASSOCIATION-ROOT-GCLX_LHTDW.LS_MODIFY-DATA = LR_LHTDW.APPEND LS_MODIFY TO LT_MODIFY.CLEAR LS_MODIFY.ENDLOOP.CALL METHOD LO_SRV_MGR->MODIFYEXPORTINGIT_MODIFICATION = LT_MODIFYIMPORTINGEO_MESSAGE      = LO_MESSAGEEO_CHANGE       = LO_CHANGE.IF LO_MESSAGE->CHECK( ) = ABAP_TRUE.LO_MESSAGE->GET_MESSAGES( IMPORTING ET_MESSAGE = LT_MESSAGE ).LOOP AT LT_MESSAGE INTO LS_MESSAGE.LO_FPM->MO_MESSAGE_MANAGER->REPORT_OBJECT_MESSAGE(EXPORTINGIR_MESSAGE_OBJECT = LS_MESSAGE-MESSAGEIO_COMPONENT = LO_FPM->MO_MESSAGE_MANAGER).ENDLOOP.ELSE.MO_CONTROLLER->POST_SYNCUP_DATA( IV_BO_KEY  = ZRRE_IF_PROJ_CONSTANTS=>SC_BO_KEY IO_CHANGE  = LO_CHANGE ).ENDIF.ENDIF.ENDIF.ENDCASE."因为BOPF的Determination 数据重更新,此处对<FT_DATA> 做去重处理LT_SORT = VALUE #(( NAME = 'KEY' DESCENDING = '' ) ).SORT <FT_DATA> BY (LT_SORT)."动态内表按指定字段排序"删除连续重复项DELETE ADJACENT DUPLICATES FROM <FT_DATA>.UPDATE_FIELD_STATUS( EXPORTING IV_EDIT_MODE = IV_EDIT_MODECHANGING CT_DATA  = CT_DATACT_FIELD_USAGE = CT_FIELD_USAGECT_ACTION_USAGE = CT_ACTION_USAGE ).*---Shared dictionary---------------------------------------------DATA: LV_CONFIG_ID TYPE        WDY_CONFIG_ID,LO_DIC       TYPE REF TO /RER/CL_SHARED_DIC.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_VALUEEXPORTINGIV_KEY   = /RER/IF_CCM_CONSTANTS=>GC_WD_CONFIGID  "'SAP-WD-CONFIGID'IMPORTINGEV_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_USGIMPORTINGEV_FIELD_USAGE_CHANGED  = EV_FIELD_USAGE_CHANGEDEV_ACTION_USAGE_CHANGED = EV_ACTION_USAGE_CHANGEDCHANGINGCT_ACTION_USAGE         = CT_ACTION_USAGE
*           ct_row_act              =CT_FIELD_USAGE          = CT_FIELD_USAGE.ENDIF.ENDIF.
*-----------------------------------------------------------EV_DATA_CHANGED = ABAP_TRUE.EV_FIELD_USAGE_CHANGED = ABAP_TRUE.EV_ACTION_USAGE_CHANGED = ABAP_TRUE.ENDMETHOD.

4)IF_FPM_GUIBB_LIST~GET_DEFINITION:此方法针对字段属性进行控制,例如必输、只读、隐藏、搜索帮助等设置。

  METHOD IF_FPM_GUIBB_LIST~GET_DEFINITION.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.DATA: LS_ACTION_DEF   TYPE FPMGB_S_ACTIONDEF.CALL METHOD SUPER->IF_FPM_GUIBB_LIST~GET_DEFINITIONIMPORTINGEO_FIELD_CATALOG         = EO_FIELD_CATALOGET_FIELD_DESCRIPTION     = ET_FIELD_DESCRIPTIONET_ACTION_DEFINITION     = ET_ACTION_DEFINITIONET_SPECIAL_GROUPS        = ET_SPECIAL_GROUPSES_MESSAGE               = ES_MESSAGEEV_ADDITIONAL_ERROR_INFO = EV_ADDITIONAL_ERROR_INFOET_DND_DEFINITION        = ET_DND_DEFINITIONET_ROW_ACTIONS           = ET_ROW_ACTIONSES_OPTIONS               = ES_OPTIONS.*    CLEAR LS_ACTION_DEF.
*    LS_ACTION_DEF-ID = GC_LIFNR_ENTERED. "'LIFNR_ENTERED'.
*    LS_ACTION_DEF-ACTION_TYPE = IF_FPM_CONSTANTS=>GC_ACTION_TYPE-VALIDATION_INDEPENDENT.
*    LS_ACTION_DEF-ENABLED = ABAP_TRUE.
*    LS_ACTION_DEF-IS_IMPLICIT_EDIT = ABAP_TRUE.
*    INSERT LS_ACTION_DEF INTO TABLE ET_ACTION_DEFINITION.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_VALUEEXPORTINGIV_KEY   = /RER/IF_CCM_CONSTANTS=>GC_WD_CONFIGID  "'SAP-WD-CONFIGID'IMPORTINGEV_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_DEFCHANGINGCT_ACT      = ET_ACTION_DEFINITIONCT_LIST_FLD = ET_FIELD_DESCRIPTION.ENDIF.ENDIF.ENDMETHOD.

此处例子是增强实施实现字段的搜索帮助:

  METHOD IPO_ZRRE_EHI_GCLX_LHTDW~GET_DEFINITION.
*"------------------------------------------------------------------------*
*" Declaration of POST-method, do not insert any comments here please!
*"
*"methods GET_DEFINITION
*"  changing
*"    value(EO_FIELD_CATALOG) type ref to CL_ABAP_TABLEDESCR
*"    !ET_FIELD_DESCRIPTION type FPMGB_T_LISTFIELD_DESCR
*"    !ET_ACTION_DEFINITION type FPMGB_T_ACTIONDEF
*"    !ET_SPECIAL_GROUPS type FPMGB_T_SPECIAL_GROUPS
*"    !ES_MESSAGE type FPMGB_S_T100_MESSAGE
*"    !EV_ADDITIONAL_ERROR_INFO type DOKU_OBJ
*"    !ET_DND_DEFINITION type FPMGB_T_DND_DEFINITION
*"    !ET_ROW_ACTIONS type FPMGB_T_ROW_ACTION
*"    !ES_OPTIONS type FPMGB_S_LIST_OPTIONS .
*"------------------------------------------------------------------------*READ TABLE ET_FIELD_DESCRIPTION ASSIGNING FIELD-SYMBOL(<FS_FIELD_DESC>) WITH KEY NAME = 'ZLHTDW_ID'.IF SY-SUBRC = 0.<FS_FIELD_DESC>-DDIC_SHLP_NAME = 'ZRRE_H_VEND_04'.ENDIF.ENDMETHOD.

5)UPDATE_FIELD_STATUS:该方法为自定义方法,只要实现根据字段值实现对字段的属性控制,一般在get_data方法中调用。

  METHOD IOW_ZRRE_EHI_GCLX_LHTDW~UPDATE_FIELD_STATUS.
*"------------------------------------------------------------------------*
*" Declaration of Overwrite-method, do not insert any comments here please!
*"
*"methods UPDATE_FIELD_STATUS
*"  importing
*"    !IV_EDIT_MODE type FPM_EDIT_MODE optional
*"  changing
*"    !CT_ACTION_USAGE type FPMGB_T_ACTIONUSAGE optional
*"    !CT_DATA type DATA optional
*"    !CT_FIELD_USAGE type FPMGB_T_FIELDUSAGE optional .
*"------------------------------------------------------------------------*FIELD-SYMBOLS <FS_FIELD> TYPE FPMGB_S_FIELDUSAGE.FIELD-SYMBOLS: <FT_DATA> TYPE STANDARD TABLE,<FS_DATA> TYPE ANY.FIELD-SYMBOLS: <FS_FIELD_DESC>   TYPE FPMGB_S_TREEFIELD_DESCR,<FS_ACTION_USAGE> TYPE FPMGB_S_ACTIONUSAGE.FIELD-SYMBOLS:<FV_FIELD>    TYPE ANY,<FV_VALUE>    TYPE ANY,<FV_TAX_TYPE> TYPE ANY.DATA: LS_ROOT TYPE ZRRE_S_XMTT.MOVE-CORRESPONDING ZRRE_CL_FD_PROJ_GCLX=>MS_ROOT TO LS_ROOT.ASSIGN CT_DATA TO <FT_DATA>.IF IV_EDIT_MODE = 'E'. "AND LS_ROOT-XMJD <> '05'."工程立项-调整 不允许编辑联合体单位明细LOOP AT <FT_DATA> ASSIGNING <FS_DATA>.LOOP AT CT_FIELD_USAGE ASSIGNING <FS_FIELD>.     "#EC CI_NESTEDCASE <FS_FIELD>-NAME .WHEN  'ZLHTDW_NAME'.READ TABLE CORE_OBJECT->MT_FIELD_DESCRIPTION ASSIGNING <FS_FIELD_DESC> WITH KEY NAME = <FS_FIELD>-NAME.IF SY-SUBRC = 0.ASSIGN COMPONENT 'READ_ONLY_REF' OF STRUCTURE <FS_FIELD_DESC> TO <FV_FIELD>.ASSIGN COMPONENT <FV_FIELD> OF STRUCTURE <FS_DATA> TO <FV_VALUE>.<FV_VALUE> = ABAP_FALSE.ENDIF.ENDCASE.ENDLOOP.ENDLOOP.LOOP AT CT_ACTION_USAGE ASSIGNING <FS_ACTION_USAGE> WHERE ID = /RER/IF_CCM_CONSTANTS=>GC_EVENT-FBI_CREATE "'FBI_CREATE'OR ID = /RER/IF_CCM_CONSTANTS=>GC_EVENT-FBI_DELETE. "'FBI_DELETE' .<FS_ACTION_USAGE>-ENABLED = ABAP_TRUE.ENDLOOP.ELSE.LOOP AT <FT_DATA> ASSIGNING <FS_DATA>.LOOP AT CT_FIELD_USAGE ASSIGNING <FS_FIELD>.     "#EC CI_NESTEDREAD TABLE CORE_OBJECT->MT_FIELD_DESCRIPTION ASSIGNING <FS_FIELD_DESC> WITH KEY NAME = <FS_FIELD>-NAME.IF SY-SUBRC = 0.ASSIGN COMPONENT 'READ_ONLY_REF' OF STRUCTURE <FS_FIELD_DESC> TO <FV_FIELD>.ASSIGN COMPONENT <FV_FIELD> OF STRUCTURE <FS_DATA> TO <FV_VALUE>.<FV_VALUE> = ABAP_TRUE.ENDIF.ENDLOOP.ENDLOOP.LOOP AT CT_ACTION_USAGE ASSIGNING <FS_ACTION_USAGE> WHERE ID = /RER/IF_CCM_CONSTANTS=>GC_EVENT-FBI_CREATE "'FBI_CREATE'OR ID = /RER/IF_CCM_CONSTANTS=>GC_EVENT-FBI_DELETE. "'FBI_DELETE'.<FS_ACTION_USAGE>-ENABLED = ABAP_FALSE.ENDLOOP.ENDIF.ENDMETHOD.

2、bopf后端对应的Determination的类:ZRRE_EHI_LHTDW_PSTDET,此处主要实现页面修改过程中对数据的处理,例如:创建人、创建日期等字段的赋值,同时更新数据同步到前端页面,保证前后端数据的一致性。
1)类的参考:
在这里插入图片描述2)继承的接口:
在这里插入图片描述3)继承的方法:
在这里插入图片描述4)重写方法AFTER_MODIFICATION:保证修改页面过程中数据的同步更新。

  METHOD AFTER_MODIFICATION.
**TRY.
*CALL METHOD SUPER->AFTER_MODIFICATION
*  EXPORTING
*    IS_CTX        = IS_CTX
*    IT_KEY        = IT_KEY
*    IO_READ       = IO_READ
*    IO_MODIFY     = IO_MODIFY
**  IMPORTING
**    ET_FAILED_KEY = ET_FAILED_KEY
*    .
**  CATCH /RER/CX_FATAL.
**ENDTRY.SET_VALUE(EXPORTINGIS_CTX        = IS_CTXIT_KEY        = IT_KEYIO_READ       = IO_READIO_MODIFY     = IO_MODIFYIMPORTINGET_FAILED_KEY = ET_FAILED_KEY).ENDMETHOD.

5)自定义方法SET_VALUE的实现:

  METHOD SET_VALUE.DATA: LV_ALAND TYPE ALAND,LV_WAERS TYPE WAERS,LT_KEY   TYPE /BOBF/T_FRW_KEY,LS_KEY   TYPE /BOBF/S_FRW_KEY,LR_DATA  TYPE REF TO DATA,LR_ROOT  TYPE REF TO DATA,LV_COUNT TYPE I,LT_LHTDW TYPE ZRRE_T_GCLX_LHTDW,LT_ROOT  TYPE ZRRE_T_XMTT,LS_ROOT  TYPE ZRRE_S_XMTT.FIELD-SYMBOLS: <FS_LHTDW> TYPE ZRRE_S_GCLX_LHTDW,<FS_ROOT>  TYPE ZRRE_S_XMTT,<FV_FIELD> TYPE ANY,<FS_DATA>  TYPE ANY.CHECK IT_KEY IS NOT INITIAL.CALL METHOD IO_READ->RETRIEVEEXPORTINGIV_NODE       = IS_CTX-NODE_KEYIT_KEY        = IT_KEYIV_FILL_DATA  = ABAP_TRUEIMPORTINGET_DATA       = LT_LHTDWET_FAILED_KEY = ET_FAILED_KEY.CLEAR LT_KEY.LOOP AT LT_LHTDW ASSIGNING <FS_LHTDW>.LS_KEY-KEY = <FS_LHTDW>-PARENT_KEY.APPEND LS_KEY TO LT_KEY.ENDLOOP.SORT LT_KEY BY KEY.DELETE ADJACENT DUPLICATES FROM LT_KEY COMPARING KEY.IO_READ->RETRIEVE(EXPORTINGIV_NODE                 =  ZRRE_IF_PROJ_CONSTANTS=>SC_NODE-ROOTIT_KEY                  =  LT_KEYIV_FILL_DATA           = ABAP_TRUEIMPORTINGET_DATA                =  LT_ROOT).READ TABLE LT_ROOT ASSIGNING <FS_ROOT> INDEX 1."Calculate tax amountLOOP AT LT_LHTDW ASSIGNING <FS_LHTDW> .IF <FS_LHTDW>-ZLHTDW_ID IS NOT INITIAL.SELECT SINGLE BPNAMFROM ZRRE_D_BPINTO <FS_LHTDW>-ZLHTDW_NAMEWHERE BPTYP = '04'AND APPSTATUS = '40'AND ZXZT = '01'AND BPNUM =  <FS_LHTDW>-ZLHTDW_IDAND DELFLAG = ''.ENDIF.IF <FS_LHTDW>-CREA_UNAME IS INITIAL .<FS_LHTDW>-CREA_UNAME = SY-UNAME.ENDIF.IF <FS_LHTDW>-CREA_DATE IS INITIAL .<FS_LHTDW>-CREA_DATE = SY-DATUM.ENDIF.IF <FS_LHTDW>-CREA_TIME IS INITIAL .<FS_LHTDW>-CREA_TIME = SY-UZEIT.ENDIF.<FS_LHTDW>-UPDATE_UNAME = SY-UNAME.<FS_LHTDW>-UPDATE_DATE = SY-DATUM.<FS_LHTDW>-UPDATE_TIME = SY-UZEIT.GET REFERENCE OF <FS_LHTDW> INTO LR_DATA.IO_MODIFY->UPDATE( EXPORTING IV_NODE = IS_CTX-NODE_KEY IV_KEY = <FS_LHTDW>-KEY  IS_DATA = LR_DATA ).ENDLOOP.ENDMETHOD.

6)配置触发的Determination Configuration:由于前面是进行了AFTER_MODIFICATION方法的重写,此处需要配置对应的触发配置。
在这里插入图片描述

这篇关于RERCS系统-WDA+BOPF框架实战例子 PART 3-Feeder Class 方法处理与解释的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1027690

相关文章

Linux换行符的使用方法详解

《Linux换行符的使用方法详解》本文介绍了Linux中常用的换行符LF及其在文件中的表示,展示了如何使用sed命令替换换行符,并列举了与换行符处理相关的Linux命令,通过代码讲解的非常详细,需要的... 目录简介检测文件中的换行符使用 cat -A 查看换行符使用 od -c 检查字符换行符格式转换将

Java编译生成多个.class文件的原理和作用

《Java编译生成多个.class文件的原理和作用》作为一名经验丰富的开发者,在Java项目中执行编译后,可能会发现一个.java源文件有时会产生多个.class文件,从技术实现层面详细剖析这一现象... 目录一、内部类机制与.class文件生成成员内部类(常规内部类)局部内部类(方法内部类)匿名内部类二、

SpringBoot实现数据库读写分离的3种方法小结

《SpringBoot实现数据库读写分离的3种方法小结》为了提高系统的读写性能和可用性,读写分离是一种经典的数据库架构模式,在SpringBoot应用中,有多种方式可以实现数据库读写分离,本文将介绍三... 目录一、数据库读写分离概述二、方案一:基于AbstractRoutingDataSource实现动态

Python FastAPI+Celery+RabbitMQ实现分布式图片水印处理系统

《PythonFastAPI+Celery+RabbitMQ实现分布式图片水印处理系统》这篇文章主要为大家详细介绍了PythonFastAPI如何结合Celery以及RabbitMQ实现简单的分布式... 实现思路FastAPI 服务器Celery 任务队列RabbitMQ 作为消息代理定时任务处理完整

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

Java中的String.valueOf()和toString()方法区别小结

《Java中的String.valueOf()和toString()方法区别小结》字符串操作是开发者日常编程任务中不可或缺的一部分,转换为字符串是一种常见需求,其中最常见的就是String.value... 目录String.valueOf()方法方法定义方法实现使用示例使用场景toString()方法方法

Java中List的contains()方法的使用小结

《Java中List的contains()方法的使用小结》List的contains()方法用于检查列表中是否包含指定的元素,借助equals()方法进行判断,下面就来介绍Java中List的c... 目录详细展开1. 方法签名2. 工作原理3. 使用示例4. 注意事项总结结论:List 的 contain

C#使用SQLite进行大数据量高效处理的代码示例

《C#使用SQLite进行大数据量高效处理的代码示例》在软件开发中,高效处理大数据量是一个常见且具有挑战性的任务,SQLite因其零配置、嵌入式、跨平台的特性,成为许多开发者的首选数据库,本文将深入探... 目录前言准备工作数据实体核心技术批量插入:从乌龟到猎豹的蜕变分页查询:加载百万数据异步处理:拒绝界面

Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis

MyBatis 动态 SQL 优化之标签的实战与技巧(常见用法)

《MyBatis动态SQL优化之标签的实战与技巧(常见用法)》本文通过详细的示例和实际应用场景,介绍了如何有效利用这些标签来优化MyBatis配置,提升开发效率,确保SQL的高效执行和安全性,感... 目录动态SQL详解一、动态SQL的核心概念1.1 什么是动态SQL?1.2 动态SQL的优点1.3 动态S