Hi Experts,
I having
3 views (view1, view2, view3) - each of this view having 3 context node
-> 2 model node(BuilHeader & BuilMktAttributeRel) and 1 ValueNode(Testing1,2,3)
(Testing1 for view1, Testing2 for view2, Testing3 for view3)
1 Overview Page (Overview1) - this view having a contextnode which is BuilHeader only
1 Viewset (Viewset1) - this view also having only contextnode BuilHeader
Overview1 containing view1, view2 and view3
Viewset1 containing Overview1
I binding all the 3 views valuenode(Testing1,2,3) to Viewset1's BuilHeader context node.
How do I achieve the purpose of the edit button(I did created the button) which is before I click on the Edit button, those 3 views is in Display mode.
Please help.
Thanks.
My code is below :
METHOD eh_onedit.
DATA: lr_entity TYPE REF TO cl_crm_bol_entity,
lr_controller TYPE REF TO zl_z_custom_bspwdcomponen_impl,
lv_no_authority TYPE bu_boolean,
lv_root_object TYPE REF TO if_genil_cont_root_object,
lt_return TYPE TABLE OF bapiret2,
lv_guid TYPE bu_partner_guid.
DATA: lv_msg_service TYPE REF TO cl_bsp_wd_message_service,
lv_dummy. "#EC NEEDED
TRY.
lr_controller ?= me->comp_controller.
lr_entity ?= lr_controller->typed_context->builheader->collection_wrapper->get_current( ).
IF lr_entity IS BOUND.
CALL METHOD lr_entity->if_bol_bo_property_access~get_property_as_value
EXPORTING
iv_attr_name = 'BP_GUID'
IMPORTING
ev_result = lv_guid.
CALL METHOD cl_crm_buil_services=>authority_check
EXPORTING
iv_activity = cl_crm_buil_services=>gc_aktyp_display
iv_partner_guid = lv_guid
iv_add_message_to_log = space
IMPORTING
ev_no_authority = lv_no_authority.
IF lv_no_authority = 'X'.
lv_msg_service = me->view_manager->get_message_service( ).
* give an error message that the partner cannot be processed.
MESSAGE e067(crm_bupa_bol) INTO lv_dummy.
lv_msg_service->add_message( iv_msg_type = sy-msgty
iv_msg_id = sy-msgid
iv_msg_number = sy-msgno ).
cl_crm_buil_services=>set_prevent_partner_lock( iv_prevent_lock_value = abap_true ).
EXIT.
ENDIF.
ENDIF.
IF lr_entity->lock( ) EQ abap_true.
activity = '2'. " edit
me->view_group_context->set_view_editable( me ).
ELSE.
activity = '3'. " display
ENDIF.
CATCH cx_sy_move_cast_error. " still value node?
activity = '1'. " create
CATCH cx_sy_ref_is_initial.
ENDTRY.
ENDMETHOD.
METHOD do_prepare_output.
DATA: ls_button TYPE crmt_thtmlb_button.
CALL METHOD super->do_prepare_output
EXPORTING
iv_first_time = iv_first_time.
* Buttons
IF gt_button IS INITIAL.
* ls_button-text = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BP/BP_EDIT' ). "#EC NOTEXT
ls_button-type = cl_thtmlb_util=>gc_icon_edit.
ls_button-on_click = 'EDIT'. "#EC NOTEXT
APPEND ls_button TO gt_button.
CLEAR ls_button.
ENDIF.
* set button status
TRY.
ls_button-enabled = me->view_group_context->is_view_in_display_mode( me ).
CATCH cx_sy_ref_is_initial.
ENDTRY.
MODIFY gt_button FROM ls_button TRANSPORTING enabled
WHERE enabled NE ls_button-enabled.