cancel
Showing results for 
Search instead for 
Did you mean: 

Creating dynamic tranparent container

Former Member
0 Kudos

Hi,

I have to create a dynamic tranparent container, i have added the following code , but it gives dump.

Error : The following error text was processed in the system SCC : The ASSERT condition was violated in Screen.

Kindly help.

Code:

*Create container

DATA: lr_container1 TYPE REF TO cl_wd_uielement_container,

lr_tranparent_container TYPE REF TO cl_wd_transparent_container,

lr_flow_data_tc TYPE REF TO cl_wd_flow_data.

lr_tranparent_container = cl_wd_transparent_container=>new_transparent_container(

height = '10'

width = '20'

id = 'TEST'

).

lr_flow_data_tc = cl_wd_flow_data=>new_flow_data( element = lr_tranparent_container ).

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

lr_container1->add_child( lr_tranparent_container ).

Accepted Solutions (0)

Answers (3)

Answers (3)

uday_gubbala2
Active Contributor
0 Kudos

So now if you compare my coding with yours then you can see that you have missed out on specifying the Layout property for your TransparentContainer i.e, the corresponding statement:

cl_wd_flow_layout=>new_flow_layout( container = lr_trans_container ).

Provide a similar one even for your container & your component should be working fine.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi,

I guess that you are getting the dump coz you have missed out on specifying 1 of the layout properties. If the UI element that you are adding on to your layout is a normal element then you need to just fill its LayoutData property. But however if the UI element is a container element (like a Group, TransparentContainer, Tray...) then you need to specify 2 properties:

Layout & LayoutData

The property which you specify for the Layout would be inherited by all UI elements that you would embed within your container element.

Check the code fragment below in which I am dynamically creating a TransparentContainer & embedding a Caption within it. You can try paste it inside your WDDOMODIFYVIEW method & check the results.

METHOD wddomodifyview .
  DATA: lr_root_container TYPE REF TO cl_wd_transparent_container,
        lr_trans_container TYPE REF TO cl_wd_transparent_container,
        lr_caption TYPE REF TO cl_wd_caption.

  lr_root_container ?= view->get_root_element( ).

  lr_trans_container ?= cl_wd_transparent_container=>new_transparent_container( ).
"*** Since you are creating an element of type container. You need to specify 2 layout properties:
"*** Layout & LayoutData. Layout specifies as to how the layout property which would be inherited by
"*** any elements that are embedded within this container. Whereas LayoutData controls whether the element
"*** should appear in the same line or next line. This is useful in layouts like Matrix layout.

  cl_wd_flow_layout=>new_flow_layout( container = lr_trans_container ).
  cl_wd_flow_data=>new_flow_data( element = lr_trans_container ).


  lr_caption ?= cl_wd_caption=>new_caption( text = 'This is my caption!' ).
  cl_wd_flow_data=>new_flow_data( element = lr_caption ).

"*** Embed the created caption within our TransparentContainer
  lr_trans_container->add_child( the_child = lr_caption ).

"*** Add the created TransparentContainer as a child of ROOTUIELEMENTCONTAINER
  lr_root_container->add_child( the_child = lr_trans_container ).
ENDMETHOD.

Former Member
0 Kudos

Hi,

Have you written the code in WDDOMODIFY VIEW method.

Please check out this link -

Check in ST22 for the error and paste the same.

Regards,

Lekha.