cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete the groupbox dynamically in webdynpro

Former Member
0 Kudos

Hi,

My requirement while select the create button and click the ok means it will show the below image

if we click the add button dynamic group box will be created.then we enter the required value in the input box and click display means

date is populating in the table in the below image........

My issue is while clicking the back button the dynamic group should invalidate.if we again do the same process in above image.but dynamic groupbox also coming while creating new one..

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Prabu,

you cant delete dynamically a UI element instead of that on click of back button try to hide the group

so that what ever the UI is present in that group are hidden.

if we again do the same process in above image.but dynamic groupbox also coming while creating new one.

what i understood from the line u wrote.

The number of time's on click of ADD button Group box is created again and again if this is the question.

there is parameter in WDDOMODIFYVIEW method i.e., FIRST_TIME

what ever the code you have return in WDDOMODIFYVIEW try to keep that in

if  first_time = abap_true.

---------( Code of your's )

------

endif.

if i have answered for a wrong question please elaborate your requirment.

Madhukiran M.


Former Member
0 Kudos

Hi Madhukiran,

This is my initial screen while clicking on ok button it will navigate to main view


In the main view if we click the add button only dynamic group box is creating before it is a manual group box .once the value is entered then if we click the back button it will navigate to initial screen.once again we select create and press k means dynamic group box want to be hide..

Can u give some example code to hide the groupbox and which method we have to write the code..

Former Member
0 Kudos

Hi Prabu,

if you are using Group ui element you delete it dynamically if you have created dynamically.

1) Get the reference of ROOTUIELEMENTCONTAINER which is parent.

2) After getting the reference of parent UI in that u have method REMOVE_CHILD

in this pass the parameter ID and ID should be GROUP UI element ID.

DATA lr_container  TYPE REF TO cl_wd_uielement_container.

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

----------------------This peace of code should be executed when you click on BACK button

so for that take a global variable flag when you click BACK button set this flag to TRUE

and in WDDOMODIFYVIEW write this code.

lv_flag it's global variable

IF lv_flag = abap_true.

LR_CONTAINER->REMOVE_CHILD(

   exporting

     ID        = 'GROUP'       " what ever the ID you have give place that instead of GROUP

*    INDEX     =

*  receiving

*    THE_CHILD =

).

clear lv_flag.

endif.