Skip to Content

Check-box --- Read only property in Table UI Element of Webdynpro

Hi Experts,

We have standard SRM webdynpro component where in we have a Table UI element about 26 columns,

Here one of the Column is a check-box. Based on the Login user this check box column should be in read only mode.

for instance if any users log-in he should have the previlage to check or uncheck the check box, But whenever an approvers sees the same page the check-box column should be in a dis-abled mode. i tried the below code... but unfortunately it is not behaving as expected.

"Get table reference
    lo_table ?= view->get_element('ITEMS_TABLE').

    "Get Columns of table

    lt_cols = lo_table->get_columns( ).

    "Check if no columns found
    IF lt_cols[] IS INITIAL.

      "get grouped columns list
      lt_grp_cols = lo_table->get_grouped_columns( ).

      "collect into columns table
      LOOP AT lt_grp_cols INTO ls_grp_cols.
        ls_cols ?= ls_grp_cols.
        APPEND ls_cols TO lt_cols.

    "For each column and its editor, set the read only property
    LOOP AT lt_cols INTO ls_cols.

      " get the cell editor,
      lo_inp ?= ls_cols->get_table_cell_editor( ).

IF ls_cols->id = 'ITEMS_TABLE_ACPT_IND'.

      IF lo_inp IS BOUND.
        lv_path =  lo_inp->bound__primary_property( ).

        CONCATENATE lv_path 'READ_ONLY' INTO lv_path SEPARATED BY ':'.


      "bind the read_only property to the attributes property

        lo_inp->bind_read_only( path = lv_path ).



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 31, 2015 at 07:59 AM

    Hi Balajisha,

    in modifyview, you bound to READ_ONLY property of attribute and it looks fine.

    But you are not setting the value for READ_ONLY property of context attribute.

    Refer below code:

    METHOD onactionlock .
      DATA lv_btn_name    TYPE string.
      DATA lv_lock        TYPE wdy_boolean.
      DATA lo_node        TYPE REF TO if_wd_context_node.
      DATA lt_elements    TYPE wdr_context_element_set.
      DATA ls_elements    LIKE LINE OF lt_elements.
      DATA lt_attr_names  TYPE string_table.
      DATA lv_attr_name   LIKE LINE OF lt_attr_names.
      DATA ls_data        TYPE wd_this->element_data.   "get button name
          EXPORTING name = 'ID'
          IMPORTING value = lv_btn_name ).
      " Prepare the locking/unlocking value based on button
      CASE lv_btn_name.
        WHEN 'BTN_LOCK'.
          lv_lock = abap_true.
        WHEN 'BTN_UNLOCK'.
          lv_lock = abap_false.
        WHEN OTHERS.
          lv_lock = abap_false.
      ENDCASE.   "=================================
      " Read node data and set the read only properties of cells
      "=================================   FIELD-SYMBOLS: <fs_value> TYPE any.   lo_node = wd_context->get_child_node( name = wd_this->wdctx_data ).   lt_elements = lo_node->get_elements(
      ).   "get the attributes list
      lt_attr_names =
      lo_node->get_node_info( )->get_attribute_names( ). LOOP AT lt_elements INTO ls_elements.
            static_attributes = ls_data
        ).     LOOP AT lt_attr_names INTO lv_attr_name.       UNASSIGN <fs_value>.
          ASSIGN COMPONENT lv_attr_name OF STRUCTURE ls_data TO <fs_value>.       IF <fs_value> IS NOT INITIAL.         ls_elements->set_attribute_property(
                attribute_name = lv_attr_name
                property       = if_wd_context_element=>e_property-read_only
                value          = lv_lock
            ).       ENDIF.

    Hope this helps you.



    Add comment
    10|10000 characters needed characters exceeded