cancel
Showing results for 
Search instead for 
Did you mean: 

Hi......Question on Check box group.

Former Member
0 Kudos

Hi All

I added check box group to my UI and totally dsiplaying 8 check boxes.

In 8 check boxes I selected more than one check box.

how we can capture how many check boxes selected in Check box group?

Thanks

Rama..

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member515618
Active Participant
0 Kudos

Hi Rama,

Unfortunately there is no direct method to get the selected checkboxes in a group.

Instead what we can do is.

The check box group is bound to a context node of cardinality to hold more than 1 records.

So when you want to get the selected records, do the following.


  DATA lo_nd_checkbox TYPE REF TO if_wd_context_node.
  DATA lo_el_checkbox TYPE REF TO if_wd_context_element.
  DATA lt_el_checkbox TYPE wdr_context_element_set.
  DATA ls_checkbox TYPE wd_this->element_checkbox.
  DATA lt_checkbox TYPE TABLE OF wd_this->element_checkbox.

* navigate from <CONTEXT> to <CHECKBOX> via lead selection
  lo_nd_checkbox = wd_context->get_child_node( name = wd_this->wdctx_checkbox ).
* get element via lead selection
  lo_el_checkbox = lo_nd_checkbox->get_element(  ).

  CALL METHOD lo_nd_checkbox->get_selected_elements
    RECEIVING
      set = lt_el_checkbox.

Describe the table lt_el_checkbox to get the number of check boxes selected.

If you want the values of the checkboxes selected, then do the following.


 LOOP AT lt_el_checkbox INTO lo_el_checkbox .
*     get single attribute
    lo_el_checkbox->get_attribute(
      EXPORTING
        name =  `TEXTS`
      IMPORTING
        value = ls_checkbox-texts ).
    APPEND ls_checkbox TO lt_checkbox.
    CLEAR ls_checkbox.
  ENDLOOP.

So now the table lt_checkbox holds the selected checkboxes.

Hope this helps.

Regards,

Sravan Varagani

Former Member
0 Kudos

hi rama krish...

you would have bound your checkboxes to an attribute. read those attributes and check for the x field.

---regards,

alex b justin