cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete a UI element which is created dynamically

Former Member
0 Kudos

Hello:

I am creating a webdynpro applicaiton, in which i am creating dynamic ui elements(Button, textelements, input fields etc.).

I want to delete one of the ui element which is generated dynamically in above step, by onclick action of the button create dynamically in above step.

Please help in achieving this.

Thanks,
Ratna.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi every UI Element has the Option

Visible or enabled.

You must define a Binding whith an context atribute for example FORMULARUI ( Typ: WDY_BOOLEAN)

And over the Method (Button klick) you can add something like this:

* get element via lead selection

  lo_el_bildschirm = lo_nd_bildschirm->get_element(  ).

* set single attribute

  lo_el_bildschirm->set_attribute(

    EXPORTING

      name =  `FORMULARUI`

      value = space ).

Value = space or Value = ' '  meanes off

Value = 'X' means on

hope this helps

tk

Former Member
0 Kudos

Thanks for your reply TK.

But i want to delete the UI element which is created dynamically onclick of action.

Please let me know how i go about it.

Thanks,

Ratna.

Former Member
0 Kudos

got it work by using below sample code.

data: id type string.

*--To read id of button

   id = wdevent->get_string( 'ID' ).

   check wd_comp_controller->g_view is BOUND.

   DATA: lr_detail_group        type ref to cl_wd_group,

         lt_group_children      type wd_tr_uielement.

* get a pointer to the detail group

   lr_detail_group ?= wd_comp_controller->g_view->get_element( 'bowled' ).

* get children of group

   lt_group_children = lr_detail_group->get_children( ).

   read table lt_group_children

        with key table_line->id = id

        transporting no fields.

   if sy-subrc = 0.

***delete selected button

     lr_detail_group->remove_child( index = sy-tabix ).

   endif.

Thanks,

Ratna

Former Member
0 Kudos

Hi, ah ok sorry maby i readet to fast 😄

lg TK

Answers (0)