cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic programming How to assign a static UI element to a static tray

Former Member
0 Kudos

Hi There,

We are enhancing a standard WDA application and we have a few static UI element created on the view. And now we want to rearrange these element to look like this.

Current:

Root

-> Transparent container1

-> ZTray

-> Transparent container2

target

Root

-> ZTray

-> Transparent container1

-> Transparent container2

Can you help me to find out me how can i perform this 'move" assignment using dynamic programming.

Thanks for your inputs.

Rgds

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sudhir,

You can start trying something like this in WDDOMODIFYVIEW.


  DATA:
     lo_element       type ref to cl_wd_uielement,
     LO_CONTAINER    TYPE REF TO CL_WD_UIELEMENT_CONTAINER.

  IF first_time = abap_true.

    LO_CONTAINER ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    lo_element = LO_CONTAINER->REMOVE_CHILD( ID = 'ZTRAY' ).
    LO_CONTAINER->ADD_CHILD( INDEX = 1
                             THE_CHILD = LO_ELEMENT ).


  ENDIF.

I never did something like that. I guess that depending on the layout type of the view this code will need some changes (e.g matrix layout). I tried a simple test with flow layout and worked fine here.

Former Member
0 Kudos

Thanks for your reply. I wanted to attach those container within Ztray.. sorry the structure shud have been like this.

Root

-> ZTray

-


> Transparent container1

-


>Transparent container2

Former Member
0 Kudos

HI!

Try this:


   DATA:
     lo_element          type ref to cl_wd_uielement,
     LO_CONTAINER_TO     TYPE REF TO CL_WD_UIELEMENT_CONTAINER,
     LO_CONTAINER_FROM   TYPE REF TO CL_WD_UIELEMENT_CONTAINER.

  IF first_time = abap_true.

    LO_CONTAINER_FROM ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    LO_CONTAINER_TO   ?= view->get_element( 'ZTRAY' ).

    lo_element = LO_CONTAINER_FROM->REMOVE_CHILD( ID = 'TC_CONTAINER1' ).
    LO_CONTAINER_TO->ADD_CHILD( LO_ELEMENT ).

    lo_element = LO_CONTAINER_FROM->REMOVE_CHILD( ID = 'TC_CONTAINER2' ).
    LO_CONTAINER_TO->ADD_CHILD( LO_ELEMENT ).

  ENDIF.

This code removes the elements from one container (root) and moves to another one (tray).

Answers (0)