cancel
Showing results for 
Search instead for 
Did you mean: 

Create Dynamic checkbox

Former Member
0 Kudos

Hi Experts,

I want to create some 5 checkboxes based on condition, I wrote the below code and I am getting dump. Help me out.

DATA:

lr_container TYPE REF TO cl_wd_uielement_container,

lr_checkbox TYPE REF TO cl_wd_checkbox.

  • get a pointer to the RootUIElementContainer

lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lr_checkbox = cl_wd_checkbox=>new_checkbox( text = 'WD_Processor' ).

cl_wd_matrix_data=>new_matrix_data( element = lr_checkbox ).

lr_container->add_child( lr_checkbox ).

Please let me know if i am missing anything in the above code.

error details :

No access possible via the 'NULL' data reference

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: GET_BOUND_ELEMENT of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP

Method: GET_ATTRIBUTE_INTERNAL of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP

Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C0STANDARD==============CP

Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C8STANDARD==============CP

Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C8STANDARD==============CP

Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C8STANDARD==============CP

Method: IF_NW7_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/C7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program CL_WDR_VIEW_ADAPTER===========CP

Method: IF_WDR_NW7_DELTA_RENDERER~CALCULATE_DELTA_BLOCKS of program CL_WDR_VIEW_ADAPTER===========CP

Method: IF_WDR_NW7_DELTA_RENDERER~CALCULATE_DELTA_BLOCKS of program CL_WDR_WINDOW_CONTENT_ADAPTER=CP

Thanks in advance

Divakar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try like this...

make sure that your bind_checked property is bind to a node with cardinality of 1:1.... in my case i have a following

CHECK_BOX_NODE <---node name

-CHECK_BOX_VALUE <--attribute name of type wdy_boolean

put this code under your WDDOMODIFYVIEW:

DATA:

lr_container TYPE REF TO cl_wd_uielement_container,

lr_checkbox TYPE REF TO cl_wd_checkbox.

  • get a pointer to the RootUIElementContainer

lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lr_checkbox = cl_wd_checkbox=>new_checkbox(

text = 'WD_Processor'

bind_checked = 'CHECK_BOX_NODE.CHECK_BOX_VALUE'

view = view ).

cl_wd_matrix_data=>new_matrix_data( element = lr_checkbox ).

lr_container->add_child( lr_checkbox ).

Thanks

AS.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Thanks for you replies.

Your responses helped me solve the problem.

Regards

Divakar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>I want to create some 5 checkboxes based on condition

Are you sure you really need the WDDOMODIFYVIEW to create 5 checkboxes. Seems like you could acomplish the same without WDDOMODIFYVIEW coding (which should always be a last resort) by using the CheckBoxGroup UI element. The CheckBoxGroup gets bound to a context node. The number of elements in the node control how many checkboxes will be generated in the UI.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/ad884118aa1709e10000000a155106/frameset.htm

Former Member
0 Kudos

Hi,

DATA:
lr_container TYPE REF TO cl_wd_uielement_container,
lr_checkbox TYPE REF TO cl_wd_checkbox.

* get a pointer to the RootUIElementContainer
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lr_checkbox = cl_wd_checkbox=>new_checkbox( text = 'WD_Processor' ).  "GIVE IT IN CAPS
if lr_checkbox is not initial.
cl_wd_matrix_data=>new_matrix_data( element = lr_checkbox ).
if lr_contianer is not initial.
lr_container->add_child( lr_checkbox ).
endif.
endif.

Put a break point and check wether the checkbox and contianer objects are created or not.

Regards,

Lekha.