cancel
Showing results for 
Search instead for 
Did you mean: 

How to create dynamic UI element ( PANEL ) ?

Former Member
0 Kudos

Hello All,

I am trying to create dynamic UI element for (PANEL) under root element container ( Please find the code below )

But it dumps saying  " ERROR: Access using a 'ZERO' object reference is not possible. (termination: RABAX_STATE) "

in ST22 also i didnt get any clue..

But Instead of panel if i try to add Transperent container under rootelement container  (  lo_tco TYPE REF TO cl_wd_transparent_container ) it works fine..

am i missing some thing mandatory for cl_wd_panel?

METHOD wddomodifyview.

  DATA: lo_container   TYPE REF TO cl_wd_uielement_container,
              lo_matrix       TYPE REF TO cl_wd_matrix_head_data,

              lo_panel        TYPE REF TO cl_wd_panel.

CHECK first_time = 'X'.
lo_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).


lo_panel = cl_wd_panel=>new_panel(
        height               = '50'
        id                      = 'PANEL1'

        title                   = 'Panel desc' ).

  CLEAR : lo_matrix.
  lo_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lo_panel ).
  lo_panel->set_layout_data( lo_matrix ).


  CALL METHOD lo_container->add_child
    EXPORTING  index     = 1 

                            the_child = lo_panel.

ENDMETHOD.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You need to set the layout to the panel UI. Try the below code:


DATA: lo_container TYPE REF TO cl_wd_uielement_container,

         lo_matrix    TYPE REF TO cl_wd_matrix_head_data,

         lo_panel     TYPE REF TO cl_wd_panel.

   CHECK first_time = 'X'.

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

   lo_panel = cl_wd_panel=>new_panel(

           height               = '50'

           id                      = 'PANEL1'

           title                   = 'Panel desc' ).

   CLEAR : lo_matrix.

   lo_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lo_panel ).

   lo_panel->set_layout_data( lo_matrix ).

   cl_wd_matrix_layout=>new_matrix_layout( lo_panel ).

   CALL METHOD lo_container->add_child

     EXPORTING

       index     = 1

       the_child = lo_panel.

hope this helps u,

Regards,

Kiran

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi,

No such mandatory parameters in the NEW_PANEL method, the error seems that some object reference your are trying to access is having NULL.

before accessing any object, check if its bound

if lo_panel is bound.

     lo_panel->......

endif.

Share the details of st22 or your complete code to point to the right line.

Regards,

Rama