Hope you enjoy:)
Requirement: The customer wants to add an additional status to the WH Load/Unloading Stop Level. This Status should be nicely visible represented by a traffic light on the corresponding lines of the TOR overview. The user should be able to change the status on either a single or multiple Sub-Stop instance at once, as he wants to e.g. trigger PPF activities based on the status.
METHOD /bobf/if_frw_action~execute.
DATA: lt_d_tor_stop TYPE /scmtms/t_tor_stop_k,
lt_mod TYPE /bobf/t_frw_modification.
"read the stop data
io_read->retrieve(
EXPORTING
iv_node = /scmtms/if_tor_c=>sc_node-stop
it_key = it_key
IMPORTING
et_data = lt_d_tor_stop ).
"now set the indicator based on which action we are calling
LOOP AT lt_d_tor_stop ASSIGNING FIELD-SYMBOL(<s_d_tor_stop>).
<s_d_tor_stop>-my_status = SWITCH #( is_ctx-act_key WHEN zom_if_tor_c=>sc_action-stop-set_my_status_blank
THEN abap_false
WHEN zom_if_tor_c=>sc_action-stop-set_my_status_x
THEN abap_true ).
"return a success message if desired
ENDLOOP.
/scmtms/cl_mod_helper=>mod_update_multi(
EXPORTING
it_data = lt_d_tor_stop
iv_node = /scmtms/if_tor_c=>sc_node-stop
iv_bo_key = /scmtms/if_tor_c=>sc_bo_key
CHANGING
ct_mod = lt_mod ).
io_modify->do_modify( lt_mod ).
ENDMETHOD.
Implementation Class to BO Action assignment
method /SCMTMS/IF_UI_TBI_CORE~INIT.
super->/scmtms/if_ui_tbi_core~init(
EXPORTING
it_parameter = it_parameter
iv_lean = iv_lean
io_data_interface = io_data_interface ).
mv_ui_structure_name = 'ZOM_S_UI_TBI_OVW'.
get_substructure_names( EXPORTING
iv_structure_name = mv_ui_structure_name
CHANGING
cv_ui_root_structure = mv_ui_structure_root
cv_ui_item_structure = mv_ui_structure_item
cv_ui_sdep_structure = mv_ui_structure_sdep
cv_ui_sarr_structure = mv_ui_structure_sarr
cv_ui_stage_structure = mv_ui_structure_stage
cv_ui_trans_structure = mv_ui_structure_trans ).
*---- Set hierarchy type for BO overview
mv_consumer = /scmtms/if_tor_const=>sc_overview_consumer-overview.
mv_current_hier_type = /scmtms/cl_tor_hierarchy_cust=>c_overview_hierarchy.
mv_hswitch = sc_hswitch-sameconsumer.
endmethod.
METHOD /scmtms/if_ui_tbi_fpm~adapt_definition.
"call superclass for standard logic
super->/scmtms/if_ui_tbi_fpm~adapt_definition(
EXPORTING
is_uibb_key = is_uibb_key
CHANGING
ct_field_descr_form = ct_field_descr_form
ct_sort_reference = ct_sort_reference
ct_field_descr_list = ct_field_descr_list
ct_field_descr_tree = ct_field_descr_tree
ct_action_definition = ct_action_definition
ct_dnd_definition = ct_dnd_definition
ct_row_actions = ct_row_actions
cs_options_form = cs_options_form
cs_options_list = cs_options_list
cs_options_tree = cs_options_tree ).
"add new columns descriptions, tx is with reference to an OTR Text, chose or create a fitting OTR text as required in your project
DATA(lt_field) = VALUE /scmtms/cl_ui_tbi_util=>tt_fdescr(
( f = 'MY_STATUS_ICONTRA' tx = '/SCMTMS/UI_CMN/OC_STATUS' ) ).
/scmtms/cl_ui_tbi_util=>chg_fcat_t(
EXPORTING
it_text = lt_field
CHANGING
ct_descr = ct_field_descr_tree ).
"Action defintion + description
DATA(lt_action) = VALUE /scmtms/cl_ui_tbi_util=>tt_adescr(
( id = 'SET_MY_STATUS_X' tx = '/SCMTMS/UI_CMN/SET_STATUS' )
( id = 'SET_MY_STATUS_BLANK' tx = '/SCMTMS/UI_CMN/RESET_STATUS' ) ).
/scmtms/cl_ui_tbi_util=>chg_action(
EXPORTING
it_action_descr = lt_action
CHANGING
ct_action_definition = ct_action_definition ).
ENDMETHOD.
METHOD _init_internal.
CLEAR:
er_data,
ev_convclass,
es_object,
et_action,
et_elemcat,
et_fieldsource,
et_notifnode.
super->_init_internal(
EXPORTING
it_parameter = it_parameter
IMPORTING
er_data = er_data
ev_convclass = ev_convclass
es_object = es_object
et_action = et_action
et_notifnode = et_notifnode
et_elemcat = et_elemcat
et_fieldsource = et_fieldsource ).
"map the UI action to the correponding action on BO node stop
INSERT VALUE #( ui_action = 'SET_MY_STATUS_X'
group = sc_ui_groups-stop_arrival
element_cat = sc_tbi_element_cat-stop_asr
bo_key = /scmtms/if_tor_c=>sc_bo_key
bo_action = zom_if_tor_c=>sc_action-stop-set_my_status_x )
INTO TABLE et_action.
INSERT VALUE #( ui_action = 'SET_MY_STATUS_X'
group = sc_ui_groups-stop_departure
element_cat = sc_tbi_element_cat-stop_asr
bo_key = /scmtms/if_tor_c=>sc_bo_key
bo_action = zom_if_tor_c=>sc_action-stop-set_my_status_x )
INTO TABLE et_action.
INSERT VALUE #( ui_action = 'SET_MY_STATUS_BLANK'
group = sc_ui_groups-stop_arrival
element_cat = sc_tbi_element_cat-stop_asr
bo_key = /scmtms/if_tor_c=>sc_bo_key
bo_action = zom_if_tor_c=>sc_action-stop-set_my_status_blank )
INTO TABLE et_action.
INSERT VALUE #( ui_action = 'SET_MY_STATUS_BLANK'
group = sc_ui_groups-stop_departure
element_cat = sc_tbi_element_cat-stop_asr
bo_key = /scmtms/if_tor_c=>sc_bo_key
bo_action = zom_if_tor_c=>sc_action-stop-set_my_status_blank )
INTO TABLE et_action.
ENDMETHOD.
METHOD set_act_prop.
super->set_act_prop(
EXPORTING
it_key = it_key
it_parameter = it_parameter
CHANGING
ct_act_prop = ct_act_prop
cv_changed = cv_changed ).
LOOP AT it_key ASSIGNING FIELD-SYMBOL(<s_key>).
READ TABLE mt_data WITH KEY key COMPONENTS key = <s_key>-key ASSIGNING FIELD-SYMBOL(<s_data>).
CHECK sy-subrc = 0.
"Action should only be enabled for ASR sub-stops
IF <s_data>-element_cat = sc_tbi_element_cat-stop_asr.
DATA(lv_enable_act) = abap_true.
ELSE.
lv_enable_act = abap_false.
ENDIF.
"set properties for action to set status to 'X'
READ TABLE ct_act_prop
ASSIGNING FIELD-SYMBOL(<s_act_prop>)
WITH TABLE KEY key_id COMPONENTS key = <s_data>-key
id = 'SET_MY_STATUS_X'.
IF sy-subrc = 0.
<s_act_prop>-is_enable = lv_enable_act.
ELSE.
INSERT VALUE #( key = <s_data>-key id = 'SET_MY_STATUS_X' is_visible = lv_enable_act is_enable = lv_enable_act ) INTO TABLE ct_act_prop.
ENDIF.
READ TABLE ct_act_prop
ASSIGNING <s_act_prop>
WITH TABLE KEY key_id COMPONENTS key = <s_data>-key
id = 'SET_MY_STATUS_BLANK'.
IF sy-subrc = 0.
<s_act_prop>-is_enable = lv_enable_act.
ELSE.
INSERT VALUE #( key = <s_data>-key id = 'SET_MY_STATUS_BLANK' is_visible = lv_enable_act is_enable = lv_enable_act ) INTO TABLE ct_act_prop.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD build_data_table.
DATA: lt_data TYPE ty_t_data.
CLEAR et_data_table.
super->build_data_table(
EXPORTING
it_key = it_key
it_tor_root = it_tor_root
it_tor_item_all = it_tor_item_all
it_tor_item_relevant = it_tor_item_relevant
it_stop = it_stop
it_stop_succ = it_stop_succ
it_item_all = it_item_all
it_stage_overview_d = it_stage_overview_d
it_exec = it_exec
iv_execute_conversion = 'X'
iv_consumer = iv_consumer
it_erp_documents = it_erp_documents
io_hierarchy_cust = io_hierarchy_cust
it_tor_driver = it_tor_driver
it_req_attr = it_req_attr
it_ref_item = it_ref_item
it_indirect_ref_item = it_indirect_ref_item
it_ref_stop = it_ref_stop
it_indirect_ref_stop = it_indirect_ref_stop
it_resource_root = it_resource_root
it_capa_root = it_capa_root
it_kl_stop_capa_root = it_kl_stop_capa_root
it_summary_report = it_summary_report
it_charges = it_charges
it_packaging_overview = it_packaging_overview
it_stop_succ_util = it_stop_succ_util
it_loc_group_result = it_loc_group_result
it_stop_itm_loadref = it_stop_itm_loadref
it_load_dir_profile_overview = it_load_dir_profile_overview
it_att_equi_profile_overview = it_att_equi_profile_overview
it_loc_loaddir_atteqprof = it_loc_loaddir_atteqprof
it_loading_stop = it_loading_stop
it_purchase_doc = it_purchase_doc
IMPORTING
et_data_table = et_data_table ).
lt_data = et_data_table.
LOOP AT it_stop ASSIGNING FIELD-SYMBOL(<s_d_stop>) WHERE asr_indicator = /scmtms/if_asr_c=>sc_tor_stop_asr_ind-asr_relevant.
READ TABLE lt_data
ASSIGNING FIELD-SYMBOL(<s_data>)
WITH TABLE KEY key COMPONENTS key = <s_d_stop>-key.
IF sy-subrc = 0.
<s_data>-my_statustra = <s_d_stop>-my_status.
IF <s_d_stop>-my_status = abap_false.
<s_data>-my_status_icontra = /scmtms/if_ui_cmn_c=>sc_icons-red_led.
ELSE.
<s_data>-my_status_icontra = /scmtms/if_ui_cmn_c=>sc_icons-green_led.
ENDIF.
ENDIF.
ENDLOOP.
et_data_table = lt_data.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
6 | |
5 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 |