on 05-23-2011 5:10 PM
Hi experts,
I need to add container to other container dynamically.
It's my coding:
DATA lr_cont_pc TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
DATA lr_cont TYPE REF TO cl_wd_uielement_container.
DATA lr_matrix TYPE REF TO cl_wd_matrix_data.
data lr_cont_2 TYPE REF TO cl_wd_uielement_container.
lr_cont ?= view->get_element( 'RIGHT_CONTAINER' ).
CALL METHOD CL_WD_TRANSPARENT_CONTAINER=>NEW_TRANSPARENT_CONTAINER
EXPORTING
id = 'CONT_PC'
RECEIVING
control = lr_cont_pc.
lr_matrix = cl_wd_matrix_data=>new_matrix_data( lr_cont_pc ).
lr_cont_pc->set_layout_data( lr_matrix ).
CALL METHOD lr_cont->add_child
EXPORTING
index = 1
the_child = lr_cont_pc.
But I have dump:
OBJECTS_OBJREF_NOT_ASSIGNED
Access via 'NULL' object reference not possible.
Method: CREATE_NW7_BY_VIEW_ELEMENT of program CL_NW7_VIEW_ELEMENT_ADAPTER===CP
Thanks in advance
Evgeniy
Correct coding:
DATA lr_layout TYPE REF TO cl_wd_matrix_layout .
lr_cont_pc = cl_wd_transparent_container=>new_transparent_container(
id = 'CONT_PC' ).
lr_matrix = cl_wd_matrix_data=>new_matrix_data( element = lr_cont_pc ).
lr_layout ?= cl_wd_matrix_layout=>new_matrix_layout( lr_cont_pc ).
lr_cont ?= view->get_element( 'RIGHT_CONTAINER' ).
lr_cont->add_child( index = 5
the_child = lr_cont_pc ).
It was necessery to add this:
lr_layout ?= cl_wd_matrix_layout=>new_matrix_layout( lr_cont_pc ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mostly when i see this error CREATE_NW7_BY_VIEW_ELEMENT then the problem is that one or more compulsory property of the UI element is not binded.
So please check which compulsory property is not bound, i leave this investigation for your learning. If you are not able to find out then let me know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.