cancel
Showing results for 
Search instead for 
Did you mean: 

Tray Error

carlin_willams
Participant
0 Kudos

Hello All

I am creating Dynamic tray with following code in WDMODIFYVIEW Method in the View.

But it giving error "Access via 'NULL' object reference not possible."

What is wrong in below code please let me know.

data lr_cntr type REF TO cl_wd_uielement_container. .

data lr_tray type REF TO cl_wd_tray.

lr_cntr ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER').

lr_tray = cl_wd_tray=>NEW_TRAY(

CONTEXT_MENU_BEHAVIOUR = cl_wd_tray=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT

DESIGN = cl_wd_tray=>E_DESIGN-TRANSPARENT

id = 'MYTRAY'

width = '100'

ENABLED = 'X'

EXPANDABLE = 'X'

EXPANDED = 'X'

HAS_CONTENT_PADDING = 'X'

SCROLLING_MODE = cl_wd_tray=>E_SCROLLING_MODE-NONE

VISIBLE = cl_wd_tray=>E_VISIBLE-VISIBLE

).

cl_wd_flow_data=>new_flow_data( element = lr_tray ).

cl_wd_matrix_layout=>new_matrix_layout( container = lr_tray ).

lr_cntr->add_child( lr_tray ).

BR

-CW

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

On exactly which line you get this error?. probably THE lr_tray is initial. in that case please check of you have missed Any parameter for THE constructor.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Goto st22 and check where you are getting error. OR Debugg your code and find which statement is initial. Try to initial that

it will resolve.

Cheers,

Kris.

carlin_willams
Participant
0 Kudos

Hello

I am getting the Tray but i am not aable add elements into the tray used below code.

In the below i have tried adding button to the Tray.

Button is coming outside of the Tray.

What is wrong in below code.

data lr_cntr type REF TO cl_wd_uielement_container. .

data lr_tray type REF TO cl_wd_tray.

data lr_te type REF TO cl_wd_text_edit.

data lr_tv type REF TO cl_wd_text_view.

data OREF type ref to CX_ROOt.

data TEXT type STRING.

data lr_btn TYPE REF TO cl_wd_button.

lr_cntr ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER').

*lr_tray = cl_wd_tray=>NEW_TRAY( ).

lr_tray = cl_wd_tray=>NEW_TRAY(

CONTEXT_MENU_BEHAVIOUR = cl_wd_tray=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT

DESIGN = cl_wd_tray=>E_DESIGN-TRANSPARENT

id = 'MYTRAY'

width = '100%'

ENABLED = 'X'

EXPANDABLE = 'X'

EXPANDED = 'X'

HAS_CONTENT_PADDING = 'X'

SCROLLING_MODE = cl_wd_tray=>E_SCROLLING_MODE-NONE

VISIBLE = cl_wd_tray=>E_VISIBLE-VISIBLE

).

cl_wd_flow_data=>new_flow_data( element = lr_tray ).

cl_wd_matrix_layout=>new_matrix_layout( container = lr_tray ).

lr_cntr->add_child( lr_tray ).

lr_btn = cl_wd_button=>new_button( ).

CALL METHOD lr_btn->SET_TEXT

EXPORTING

VALUE = 'My Button'.

cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_btn ).

lr_tray->add_child( lr_btn ).

Former Member
0 Kudos

Hi Williams,

Try with this code, i am getting Tray and button, button is inside the tray, Check it by collapsing tray you will get idea.

data lr_cntr type REF TO cl_wd_uielement_container. .
data lr_tray type REF TO cl_wd_tray.

data lr_te type REF TO cl_wd_text_edit.
data lr_tv type REF TO cl_wd_text_view.
data OREF type ref to CX_ROOt.
data TEXT type STRING.
data lr_btn TYPE REF TO cl_wd_button.

lr_cntr ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER').

*lr_tray = cl_wd_tray=>NEW_TRAY( ).
lr_tray = cl_wd_tray=>NEW_TRAY(
CONTEXT_MENU_BEHAVIOUR = cl_wd_tray=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT
DESIGN = cl_wd_tray=>E_DESIGN-FILL        // You can try with TRANSAPARENT also.
id = 'MYTRAY'
width = '100%'
ENABLED = 'X'
EXPANDABLE = 'X'
EXPANDED = 'X'
HAS_CONTENT_PADDING = 'X'
SCROLLING_MODE = cl_wd_tray=>E_SCROLLING_MODE-NONE
VISIBLE = cl_wd_tray=>E_VISIBLE-VISIBLE
).
cl_wd_matrix_data=>new_matrix_data( element = lr_tray ).

cl_wd_matrix_layout=>new_matrix_layout( container = lr_tray ).
lr_cntr->add_child( lr_tray ).

lr_btn = cl_wd_button=>new_button( ).

CALL METHOD lr_btn->SET_TEXT
EXPORTING
VALUE = 'My Button'.
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_btn ).

lr_tray->add_child( lr_btn ).

Cheers,

Kris.

carlin_willams
Participant
0 Kudos

Thanks Kris.

Actually it was over look the button was coming inside the Tray. Now i am able to above my code and ur code.