cancel
Showing results for 
Search instead for 
Did you mean: 

Destroying UI elements

siddharth_jain
Active Contributor
0 Kudos

Hello Experts,

i have a requirement where i have to destroy some UI elements which are created dynamically from the view via coding.And i dont want to destroy all elements only specific elements.

I searched but didnt find any thing,

Any Inputs/help and suggestion are most welcome.

Thanks,

Siddharth

Edited by: Siddharth Jain on Oct 20, 2010 3:55 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Siddharth,

when you have created ui elements dynamically, you must have used the reference to rootuielement container and then you must have stored the reference of class cl_wd_uielement_container.

if you have, you could use the method remove_child of the cl_wd_uielement_container.

here is the code as well.

CHECK first_time = abap_true.

data lo_root_uielement TYPE REF TO if_wd_view_element.

data lo_container TYPE REF TO cl_wd_uielement_container.

lo_root_uielement = view->get_element( id = 'ROOTUIELEMENTCONTAINER' ).

lo_container ?= lo_root_uielement.

lo_container->remove_child( EXPORTING id = 'TEXT_UI' ).

Regards

Anurag Chopra

Former Member
0 Kudos

Hello Siddharth,

I have few more suggestion for you, if you have deep ui hierarchy then you have to reach to the parent of that particular ui element to delete it.

If you could somehow group all those ui elements which you need to delete at runtime you could define them under a group or transparent ui element or similar ui element. Once you get the reference of your gourp/transparent container etc ui element , you could rather use remov_all_children method it would delete all the ui elements defined under the group ui element instead of individually deleting the ui element.

it would make your code more effecient.

Regards

Anurag Chopra

Answers (0)