Build feeder class for the form GUIBB of initial screen
创建Class,进入接口如下
添加如下Attribute
Method实现如下
method IF_FPM_FEEDER_MODEL~GET_INPORT_KEY.
GET REFERENCE OF ms_object_key INTO rr_object_key.
method IF_FPM_FEEDER_MODEL~GET_OUTPORTS.
DATA: ls_outport TYPE if_fpm_feeder_model=>ty_s_port.
CLEAR: et_outport.
GET REFERENCE OF ms_object_key INTO ls_outport-object_key.
ls_outport-type = if_fpm_feeder_model=>cs_port_type-selection.
ls_outport-identifier = if_fpm_feeder_model=>cs_port_type-selection. "SE
ls_outport-description = cl_wd_utilities=>get_otr_text_by_alias( '/SCMTMS/UI_CMN/SELECTION' ).
INSERT ls_outport INTO TABLE et_outport.
GET REFERENCE OF ms_object_key INTO ls_outport-object_key.
ls_outport-type = if_fpm_feeder_model=>cs_port_type-collection.
ls_outport-identifier = if_fpm_feeder_model=>cs_port_type-collection. "CO
ls_outport-description = cl_wd_utilities=>get_otr_text_by_alias( '/SCMTMS/UI_CMN/COLLECTION' ).
INSERT ls_outport INTO TABLE et_outport.
method IF_FPM_FEEDER_MODEL~GET_OUTPORT_DATA.
DATA: ls_root_key TYPE /bobf/s_frw_key,
li_root_key TYPE /bobf/t_frw_key.
data: lo_entity_coll type REF TO /BOFU/IF_FBI_ENTITY_COLLECTION.
data: ls_object_key type /BOFU/CL_FBI_GUIBB_BASE=>TS_OBJECT_KEY.
CREATE OBJECT lo_entity_coll TYPE /bofu/cl_fbi_entity_collection.
CLEAR: li_root_key.
ls_root_key-key = ms_data-key.
INSERT ls_root_key INTO TABLE li_root_key.
lo_entity_coll->set_self_keys(
EXPORTING
it_keys = li_root_key ).
lo_entity_coll->set_source_conf_keys( ms_object_key ).
ro_data ?= lo_entity_coll.
method IF_FPM_FEEDER_MODEL~GET_NAMESPACE.
rv_namespace = 'FBI'.
method IF_FPM_GUIBB_FORM~FLUSH.
DATA: ls_change_log TYPE fpmgb_s_changelog.
FIELD-SYMBOLS: <fs_id> TYPE /BOBF/DEMO_CUSTOMER_ID.
READ TABLE it_change_log INTO ls_change_log
WITH KEY name = 'CUSTOMER_ID'. "#EC WARNOK
IF sy-subrc = 0.
ASSIGN ls_change_log-new_value->* TO <fs_id>.
ms_data-customer_id = <fs_id>.
ENDIF.
method IF_FPM_GUIBB_FORM~PROCESS_EVENT.
data: lo_srv_mgr TYPE REF TO /bobf/if_tra_service_manager.
data: lt_key_index type /BOBF/T_FRW_KEYINDEX.
data: ls_key_index type /bobf/s_frw_keyindex.
data: lt_customer_id type STANDARD TABLE OF /BOBF/DEMO_CUSTOMER_ID.
data: lr_customer TYPE REF TO /BOBF/S_DEMO_CUSTOMER_HDR_K.
data: lt_key type /bobf/t_frw_key.
data: ls_key type /bobf/s_frw_key.
DATA: lo_fpm TYPE REF TO if_fpm,
lo_event_data TYPE REF TO cl_fpm_parameter,
lo_event TYPE REF TO cl_fpm_event.
DATA: ls_message TYPE fpmgb_s_t100_message,
lv_new_key TYPE /bobf/conf_key,
lt_mod TYPE /bobf/t_frw_modification,
ls_mod TYPE /bobf/s_frw_modification.
data: lo_change TYPE REF TO /bobf/if_tra_change,
lo_message TYPE REF TO /bobf/if_frw_message.
if mo_controller is initial.
mo_controller ?= /bofu/cl_fbi_controller_base=>get_instance( ).
endif.
CASE io_event->mv_event_id.
WHEN if_fpm_constants=>gc_event-leave_initial_screen.
append ms_data-customer_id to lt_customer_id.
lo_srv_mgr = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /BOBF/IF_DEMO_CUSTOMER_C=>sc_bo_key ).
lo_srv_mgr->CONVERT_ALTERN_KEY(
exporting
IV_NODE_KEY = /BOBF/IF_DEMO_CUSTOMER_C=>sc_node-root
IV_ALTKEY_KEY = /BOBF/IF_DEMO_CUSTOMER_C=>SC_ALTERNATIVE_KEY-root-CUSTOMER_ID
* IV_TARGET_ALTKEY_KEY = /BOBF/IF_FRW_C=>SC_ALTERNATIVE_KEY_KEY " Alternative Key
IT_KEY = lt_customer_id
* IV_CHECK_EXISTENCE = ABAP_FALSE " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
* IV_BEFORE_IMAGE = ABAP_FALSE " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
IV_INVALIDATE_CACHE = ABAP_true " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
importing
EO_CHANGE = lo_change " Interface for transaction change objects
ET_RESULT = lt_key_index
* ET_KEY =
).
IF lo_change->has_failed_changes( ) IS not INITIAL or lt_key_index is INITIAL.
MESSAGE e001(YHENG_MESSAGE) INTO ls_message-plaintext.
ls_message-severity = if_fpm_message_manager=>gc_severity_error.
APPEND ls_message TO et_messages.
ev_result = if_fpm_constants=>gc_event_result-failed.
RETURN.
ENDIF.
loop at lt_key_index into ls_key_index.
* ls_key-key = ls_key_index-KEY.
ms_data-KEY = ls_key_index-key.
* append ls_key to lt_key.
ENDLOOP.
lo_fpm ?= cl_fpm_factory=>get_instance( ).
lo_fpm->mo_app_parameter->set_value(
EXPORTING
iv_key = /bofu/if_fbi_runtime_c=>sc_application_parameters-change_mode
iv_value = mv_mode ).
clear: lt_key.
ls_key-key = ms_data-key.
append ls_key to lt_key.
WHEN OTHERS.
ENDCASE.
method IF_FPM_GUIBB_FORM~GET_DATA.
DATA: lo_event TYPE REF TO cl_fpm_event,
lo_fpm type ref to if_fpm.
if lo_fpm is initial.
lo_fpm ?= cl_fpm=>get_instance( ).
endif.
IF io_event->mv_event_id = cl_fpm_event=>GC_EVENT_CHANGE_CONTENT_AREA.
ev_data_changed = abap_true.
if lo_fpm is NOT INITIAL.
lo_event = cl_fpm_event=>CREATE_BY_ID( cl_fpm_event=>GC_EVENT_REFRESH ).
lo_fpm->raise_event( lo_event ).
endif.
endif.
method IF_FPM_GUIBB_FORM~GET_DEFINITION.
eo_field_catalog ?= cl_abap_typedescr=>describe_by_name( '/BOBF/S_DEMO_CUSTOMER_HDR_K' ).
method IF_FPM_GUIBB~INITIALIZE.
DATA: lo_event TYPE REF TO cl_fpm_event,
lo_fpm type ref to if_fpm.
ms_object_key-bo = /BOBF/IF_DEMO_CUSTOMER_C=>sc_bo_key.
ms_object_key-node = /BOBF/IF_DEMO_CUSTOMER_C=>sc_node-root.
if lo_fpm is initial.
lo_fpm ?= cl_fpm=>get_instance( ).
endif.
IF lo_fpm is BOUND.
lo_fpm->mo_app_parameter->get_value(
EXPORTING
iv_key = /bofu/if_fbi_runtime_c=>sc_application_parameters-change_mode
IMPORTING
ev_value = mv_mode ).
if mo_controller is initial.
mo_controller ?= /bofu/cl_fbi_controller_base=>get_instance( ).
mo_controller->/bofu/if_fbi_controller~set_object_key( ms_object_key ).
mo_controller->/bofu/if_fbi_controller~build_node_buffer(
EXPORTING
iv_bo_key = /BOBF/IF_DEMO_CUSTOMER_C=>sc_bo_key
iv_node_key = /BOBF/IF_DEMO_CUSTOMER_C=>sc_node-root ).
endif.
endif.
Build viewexit class for FBI view
创建Viewexit class,引入接口
引入Attribute
实现相应的方法
method /BOFU/IF_FBI_VIEW_EXITINTF_RUN~ADAPT_EVENT.
DATA: lo_srvmgr TYPE REF TO /bofu/if_fbi_controller=>ts_bo_srvmgr_map,
lo_fpm TYPE REF TO if_fpm,
lo_event_data TYPE REF TO cl_fpm_parameter,
lo_event TYPE REF TO cl_fpm_event.
IF NOT mo_controller IS BOUND.
mo_controller ?= /bofu/cl_fbi_controller_base=>get_instance( ).
ENDIF.
READ TABLE mo_controller->/bofu/if_fbi_controller~mt_bo_srvmgr_map REFERENCE INTO lo_srvmgr
WITH TABLE KEY bo_key = iv_bo_key.
case iv_eventid.
WHEN 'BACK'.
lo_fpm ?= cl_fpm_factory=>get_instance( ).
lo_event = cl_fpm_event=>CREATE_BY_ID( iv_event_id = cl_fpm_event=>GC_EVENT_CHANGE_CONTENT_AREA ).
lo_event->mo_event_data->set_value(
iv_key = cl_fpm_event=>gc_event_param_trgt_cont_area
iv_value = 'PAGE_INITIAL' ).
lo_fpm->RAISE_EVENT( io_event = lo_event ).
when OTHERS.
ENDCASE.