Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jul 18, 2017 at 10:00 PM

    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.
    
    Add comment
    10|10000 characters needed characters exceeded

  • Jul 18, 2017 at 08:27 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 18, 2017 at 09:04 AM

    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

    Add comment
    10|10000 characters needed characters exceeded