Thursday, December 20, 2012

Dynamically make cell readonly in table web dynpro






Now assign to all the fields.

** condition for the editable or read only.
method WDDOINIT .

  DATA lo_nd_mara TYPE REF TO if_wd_context_node.
  DATA lt_mara TYPE wd_this->elements_mara.
  DATA ls_mara TYPE wd_this->element_mara.

* navigate from <CONTEXT> to <MARA> via lead selection
  lo_nd_mara = wd_context->get_child_node( name = wd_this->wdctx_mara ).

select matnr mtart mbrsh matkl meins from mara into corresponding fields of table lt_mara up to 10 rows.
  loop at lt_mara into ls_mara where matnr = '000000000000000010' or
 matnr = '000000000000000023' .
ls_mara-readonly = 'X'.
modify lt_mara from ls_mara transporting readonly where matnr = ls_mara-matnr.
  endloop.
lo_nd_mara->bind_table( new_items = lt_mara set_initial_elements = abap_true ).

endmethod.

Done!.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.