cancel
Showing results for 
Search instead for 
Did you mean: 

Handling table cells, rows and columns

Former Member
0 Kudos

Hi!

I think this will be easy for you, but unfortunately I'm a newbie in the webdynpro business.

I have an internal table and I've binded it to a table on the view.

The table seems somehow like this:

TABLE1

COL1 COL2 COL3 COL4

ROW1 CELL11 CELL12 CELL13 CELL14

ROW2 CELL21 CELL22 CELL23 CELL24

ROW3 CELL31 CELL32 CELL33 CELL34

ROW4 CELL41 CELL42 CELL43 CELL44

I would like to process this table dynamically:

- in the COL1 there is a checkbox in each row, based on it's checked/unchecked status, I would like to make the COL2 column read only/ modifiable

- when COL1 was unchecked, and now it is checked, I would like to add 1 to the COL4 field's value

Thank you

Tamá

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

To achieve your first scenario, follow these steps,

1. Create an attribute 'READONLY' type boolean under the same node that is bound to your table

2. Bind this attribute to the readonly property of your Column 2 cell editor( which has to be an input field inorder to make it open for editing )

3. Now implement the event handler method for the click of your checkbox, in this method place the following code to enable/disable your col2.

data: context_element type ref to if_wd_context_element.
context_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ). 

context_element->get_static_attributes( importing static_attributes = ls_stru ). " contents of the row of clicked checkbox
if ls_stru-col1 = 'X'. "checkbox is checked
" enable/disable Col2
 ls_stru-readonly = abap_true. " to disable the field ( pass abap_false to enable the field )
" add 1 to Col4 
 ls_stru-col4 = ls_stru-col4 + 1. " col4 should be the attribute that is bound to this column
endif.

context_element->set_static_attributes( exporting static_attributes = ls_stru ).

Hope this helps!

Regards,

Radhika.