Skip to Content
0
Former Member
Feb 17, 2011 at 10:40 AM

Get the current view to draw dynamically check boxes

43 Views

Hello,

I need to draw check boxes in my view dynamically depending on an sql query result.

The problem is how to get the current view to use its method get_element.

My source code is below

thanks.

<Code>

LOOP AT lt_benef_list_node INTO ls_benef_list_node.

*Create Node

lr_view_controller = wd_this->wd_get_api( ).

CALL METHOD view->get_element EXPORTING id = 'OPTIONS_CTR' RECEIVING element = lr_root_node.

lr_container ?= lr_root_node.

lr_context_node_info = wd_context->get_node_info( ).

CONCATENATE 'Check_' counter into AttributID.

MOVE ls_benef_list_node-nodenameext TO AttributTxt.

st_contxt_attr-name = AttributID.

st_contxt_attr-type_name = 'WDY_BOOLEAN'.

*Create CheckBox

CALL METHOD cl_wd_checkbox=>new_checkbox

RECEIVING

control = lr_check_box.

*Bind checkbox to Node

lr_check_box->bind_checked( path = AttributID ).

lr_check_box->set_text( value = AttributTxt ).

cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_check_box ).

lr_container->add_child( lr_check_box ).

AttributID = ''.

ENDLOOP.

</Code>