Hi,
Let's take sales order as an example
in the EH_ONEDIT method of class CL_BT115H_S_DETAILS_IMPL, it has code to lock the entity, like
if lr_ent->is_locked( ) = abap_true.
me->view_group_context->set_view_editable( me ).
lr_vgc ?= view_group_context->get_dependant_vg_context( ).
lr_vgc->set_all_editable( ).
else.
lr_ent->lock( ).
if lr_ent->is_locked( ) eq abap_true.
view_group_context->set_view_editable( me ).
lr_vgc ?= view_group_context->get_dependant_vg_context( ).
lr_vgc->set_all_editable( ).
endif.
endif.
Then in the method where buttons are defined like IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS, it has code to check if the entity is locked. If locked, then the button is enable.
Implementation Class CL_BT115H_S_SOHOVERVIEW_IMPL->IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS
* SAVE button (New Concept: SAVE is enabled as soon as the object is locked)
IF lv_archived = abap_false.
ls_button-type = cl_thtmlb_util=>gc_icon_save.
ls_button-on_click = 'SAVE'.
ls_button-page_id = me->component_id.
lr_tx = lr_entity->get_transaction( ).
IF lr_entity IS BOUND.
ls_button-enabled = lr_entity->is_locked( ).
ENDIF.
IF lv_archived = abap_false.
APPEND ls_button TO rt_buttons.
ENDIF.
CLEAR ls_button.
I hope the above information helps.
Add comment