Skip to Content
0

Make CRM Web UI field non editable if it contains certain value

Jul 18, 2017 at 08:18 AM

110

avatar image

Hi all,

I want to make a field non editable if it contains a certain value.

The content check is done in the get_v method and the check for the field itself in the get_i method.

Cann you tell me how I can make a field non editable, if it contains a certain value?

Do I have to call the get_i method from the get_v method?

Thanks a lot.

Chris

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Dominik Bigl Jul 18, 2017 at 10:00 PM
0

So you have a DropDown with some values and if the user select a certain value the DropDown should become readonly?

Set the field readonly in get_i with something like this:

  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.

  TRY.

      IF current->is_property_readonly( 'THE_FIELDNAME' ) = abap_false. "#EC NOTEXT
        rv_disabled = 'FALSE'.
      ELSEIF current->get_property_as_string( 'THE_FIELDNAME' ) <> 'LOCKED_VALUE'. "#EC NOTEXT
        rv_disabled = 'FALSE'.
      ENDIF.

    CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
          cx_crm_genil_model_error.
      RETURN.

  ENDTRY.

And every value change must trigger a roundtrip to recheck input readyness - get_p :

CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter~fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_picklist.
    WHEN if_bsp_wd_model_setter_getter~fp_server_event.
      rv_value = 'JUST_DO_ROUNDTRIP'.
ENDCASE.

Share
10 |10000 characters needed characters left characters exceeded
Dominik Bigl Jul 18, 2017 at 08:27 AM
0

you should do the content check in get_i_...

get_v_... is used to set a value helper.

calling get_i_ in get_v_ makes no sense since get_i_ only provides TRUE/FALSE to the Framework

Share
10 |10000 characters needed characters left characters exceeded
Christian Ahrens Jul 18, 2017 at 09:04 AM
0

Thanks for your answer.

I forgot to mention, that the field is a drop down menu. I don't know if this makes any difference.

Could you tell me how I can access the current value of the menu in the get_i method?

Thank you very much.

Chris

Share
10 |10000 characters needed characters left characters exceeded