cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP: Dynamic creation of transparent container

Former Member
0 Kudos

Hello,

I have this code and it fails (null pointer exception):

transparent_container = cl_wd_transparent_container=>new_transparent_container( ).
  cl_wd_grid_data=>new_grid_data( element = transparent_container ).
  ui_container->add_child( transparent_container ).

What is the problem? Do I need to create transparent container and pass some parameters?

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Is reference ui_container initialized?

Armin

Former Member
0 Kudos

Hello Armin,

yes it is.

I have some code like this:


  "create a transparent container
  transparent_container = cl_wd_transparent_container=>new_transparent_container( ).
  cl_wd_grid_data=>new_grid_data( element = transparent_container ).
  ui_container->add_child( transparent_container ).

  "create a dropDown with figures
  drop_down_figure = cl_wd_dropdown_by_key=>new_dropdown_by_key( bind_selected_key = 'REPOSITORY.FIGURES' on_select = 'GET_OPERATOR' ).
  cl_wd_grid_data=>new_grid_data( element = drop_down_figure ).
  ui_container->add_child( drop_down_figure ).

If I comment out code where I create transparent container it works fine and creates dropDown.

However, as soon as I add transparent container I get NullPointer exception.

Thank you.

Former Member
0 Kudos

If you create a layout for the ui_container (not only layout data which refer to the parent container), does this help?

Something like:

cl_wd_grid_layout=>new_grid_layout( element = ui_container ).

Armin

Former Member
0 Kudos

Hello Armin,

I believe the code should've been like this:

cl_wd_grid_layout=>new_grid_layout( container = ui_container ).

Otherwise, it will not compile.

Unfortunately, it did not help.

Thanks.

Former Member
0 Kudos

Hello Armin,

I got it working with your suggestion.

Thank you.

Answers (0)