Skip to Content
avatar image
Former Member

Get the current view to draw dynamically check boxes

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>

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 17, 2011 at 10:51 AM

    HI

    view is available in wddomodify generally.

    you can make it availabale in all the methods by creating an attriubte of type if_wd_view.

    say its name as view1.

    then in wddomodify

    set it in view1

    wd_this->view1 = view.

    and use it in any method by fetching it

    data view1 type ref to if_Wd_view.
    view1 = wd_this->view1.
    
    then use get element 
    CALL METHOD view1->get_element
    EXPORTING
    id = 'OPTIONS_CTR'
    RECEIVING
    element = lr_root_node.

    Add comment
    10|10000 characters needed characters exceeded

    • >

      > >view is available in wddomodify generally.

      > >you can make it availabale in all the methods by creating an attriubte of type if_wd_view.

      > >say its name as view1.

      >

      > This is extremely bad advice and you should never actually do this. Accessing the view in any other step of the phase model than WDDOMODIFYVIEW can result in unpredicatble behavior and is not supported by SAP.

      >

      > Instead set flags within the other event handlers and then evaluate these flags within the WDDOMODIFYVIEW.

      OOPs is it so.

      actually i also havenot used it anywher.

      thanks for pointing out thomas.

      thanks

  • avatar image
    Former Member
    Feb 17, 2011 at 10:45 AM

    Hi ,

    This kind of code can be written in the WDDOMODIFY method of the view.

    In this method it is available.

    Thanks,

    Aditya.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 17, 2011 at 02:53 PM

    done by my self.

    Add comment
    10|10000 characters needed characters exceeded