In Overview page header level, if user checked the check box flag corresponding two field should be editable and non editable mode.
- For eg : In business role sales pro à sales cycle à campaign à under new field tabà ( if user checked flag check box make’ name’ field is editable and if user unchecked flag check box means ‘custom name’ field is no editable)
STEPS:-
- ü Go to standard component ‘CPGOE_DETAILS’ and select the specific view where you want to do operation ‘CPGOE_DETAILS/OVEFDetails’.
- ü Add attribute flag 4 type as char 1 in the content node campaign implementation class level.
- ü Create get_p method for zz_flag3 attribute in campaign context node level.
- ü Copy and paste ‘IF_BSP_WD_MODEL_SETTER_GETTER~_GET_P_XYZ’ and rename it as get_p_zz_flag3 in the content node campaign implementation class level.
- ü Inside get_p_zz_flag3 method write below code for check box pick list and trigger corresponding event handler ‘ onmyevent’.
Code:-
method GET_P_ZZ_FLAG3.
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_checkbox.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = ‘MYEVENT’. “#EC NOTEXT
* WHEN if_bsp_wd_model_setter_getter=>fp_tooltip.
* rv_value = text-001.
endcase.
endmethod.
- When user click zz_flag3 attribute ‘onmyevent’ handler will trigger here we are passing flag4 = x if user check that zz_flag3 is checked or else flag4 = space.
METHOD eh_onmyevent.
* Added by wizard: Handler for event ‘MYEVENT’
DATA : lr_entity TYPE REF TO cl_crm_bol_entity,
lr_msg TYPE REF TO cl_bsp_wd_message_service,
wa TYPE crms_mktpl_ib_cpg.
lr_entity ?= me->ztyped_context->campaign->collection_wrapper->get_current( ).
CALL METHOD lr_entity->if_bol_bo_property_access~get_properties
IMPORTING
es_attributes = wa.
IF wa-zz_flag3 IS INITIAL.
me->ztyped_context->zcampaign->flag4 = ‘X’.
ELSE.
me->ztyped_context->zcampaign->flag4 = ”.
ENDIF.
ENDMETHOD.
- ü Inside context implementation class level , inside ‘create campaign’ method we assign model to zcampaign.
- ü Create get_i method for zz_name attribute in campaign context node level.
- ü Copy and paste ‘IF_BSP_WD_MODEL_SETTER_GETTER~_GET_i_XYZ’ and rename it as get_i_zz_name in the content node campaign implementation class level.
- ü Inside get_p_zz_name method write below code for make the name field as editable if flag is checked.
Code:-
METHOD get_i_zz_name.
DATA: current TYPE REF TO if_bol_bo_property_access.
rv_disabled = ‘TRUE’.
if iterator is bound.
current = iterator->get_current( ).
else.
current = collection_wrapper->get_current( ).
endif.
IF flag4 IS NOT INITIAL.
TRY.
IF current->is_property_readonly(
‘ACTUALSTART’ ) = abap_false. “#EC NOTEXT
rv_disabled = ‘TRUE’.
ENDIF.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.
else.
TRY.
IF current->is_property_readonly(
‘ACTUALSTART’ ) = abap_false. “#EC NOTEXT
rv_disabled = ‘FALSE’.
ENDIF.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.
endif.
ENDMETHOD.
- ü Create get_i method for zz_custname attribute in campaign context node level.
- ü Copy and paste ‘IF_BSP_WD_MODEL_SETTER_GETTER~_GET_i_XYZ’ and rename it as get_i_zz_custname in the content node campaign implementation class level.
- ü Inside get_p_zz_custname method write below code for make the name field as non editable if flag is un checked.
Code:-
method GET_I_ZZ_CUSTNAME.
DATA: current TYPE REF TO if_bol_bo_property_access.
rv_disabled = ‘TRUE’.
if iterator is bound.
current = iterator->get_current( ).
else.
current = collection_wrapper->get_current( ).
endif.
IF flag4 IS INITIAL.
TRY.
IF current->is_property_readonly(
‘ACTUALSTART’ ) = abap_false. “#EC NOTEXT
rv_disabled = ‘FALSE’.
ENDIF.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.
else.
TRY.
IF current->is_property_readonly(
‘ACTUALSTART’ ) = abap_false. “#EC NOTEXT
rv_disabled = ‘TRUE’.
ENDIF.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.
endif.
endmethod.
Check the o/p in web ui:-