cancel
Showing results for 
Search instead for 
Did you mean: 

Posting values from a table into checkboxes in a checkboxgroup

Former Member
0 Kudos

Here is my situation.

I have a table I am reading into my web dynpro. There are five fields, each may or may not contain an 'X'.

I have a checkboxgroup in my web dynpro. What I need to do is read field one, and if it is 'X', set the first checkbox in the group to true. Then do the same with the other four fields. I am using a checkbox group because I am reading the labels for the fields from an existing table.

I am have not used a checkboxgroup so this is new to me. Can anyone provide some code examples I can use to get my head around this?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

See the help here. [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/ad884118aa1709e10000000a155106/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/ad884118aa1709e10000000a155106/content.htm]

See the example component as described on the help page.

Basically you need a context-node of cardinality 0..n. The number of element in the node represents number of checkboxes in the group.

bind the enabled property based on the value X from the table column.

Former Member
0 Kudos

Thanks for your response.

I've looked at the help and the examples in WDR_TEST_EVENTS and it doesn't seem to address my question. It doesn't show me how to take the values from a database table and check off the corresponding boxes in in a checkboxgroup automatically. It was helpful in allowing me to check off the boxes and passing the value to my database table.

Former Member
0 Kudos

data lo_node type if_wd_context_node.

lo_node = wd_context->get_child_node( name = wd_this->wdctx_YOUR_NODE ).

loop at lt_my_table into ls_my_table.

  if ls_my_table-check_field = 'X'.
    lo_node->set_selected( index = sy-tabix ).
  endif.

endloop.

or something like this. You can also reference the selected property at the if_wd_context_element level which does not require an index.

Answers (0)