on 10-24-2013 9:33 AM
Hi
I need to set a specific column as read only in my webdynpro, but i want to do it by coding and not by binding an Element is there a way to do that?
Thanks Ami
Hi Ami,
You can set the whole column read-only dynamically as follows. The following example is written in hook method WDDOMODIFYVIEW where parameter VIEW is availble. If you perform this logic elsewhere, you'll need to get a reference to the view object with a call to wd_this->wd_get_api( ).
DATA lo_table TYPE REF TO cl_wd_table.
DATA lo_column TYPE REF TO cl_wd_table_column.
DATA lo_inputfield TYPE REF TO cl_wd_input_field.
* Get a reference to the table column's cell editor and set its readOnly property
lo_table ?= view->get_element( 'TABLE_ID' ).
lo_column ?= lo_table->get_grouped_column( id = 'TABLE_COLUMN_ID' ).
lo_inputfield ?= lo_column->get_table_cell_editor( ).
lo_inputfield->set_read_only( abap_true ).
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For making a column(input field) as read only.
1. Bind the read only property with a attribute and set the attribute value.
2. Set the input filed by-default as read only.
Now..
Either Add a text view in place of input field so 2 point and this will be same kind of.
And on Modify-view replace the input field by text view during run time based on some action..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ami,
Try this according to your requirement :
DATA lo_nd_n_read_only TYPE REF TO if_wd_context_node.
DATA lo_el_n_read_only TYPE REF TO if_wd_context_element.
lo_nd_n_read_only = wd_context->get_child_node( name = wd_this->wdctx_n_read_only ).
lo_el_n_read_only = lo_nd_n_read_only->get_element( ).
lo_el_n_read_only->set_attribute(
name = `READ_ONLY`
value = lv_read_only ).
Regards,
Shahir Mirza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can write code in method 'WDDOMODIFYVIEW' of view to achieve this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.