cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Tray- events

narendar_naidu
Active Participant
0 Kudos
93

Hi All,

I have two trays and with few UI elements in Each.

I want to handle dynamically, if one tray is selected  i want to collapse the other tray,similarly vice versa.

The Trays i have created in the layout and there is no binding done.

regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Create a node with 2 attribute.. bind the Expanded property of tray with attribute..

OnToggle, change the value of attribute accordingly.

narendar_naidu
Active Participant
0 Kudos

Hi Chandra,

Thanks for your reply, i knew that this can be done creating the attribute and then changing them attribute value,

but i want to know is there any class where i can access the list of screen ui elements and set their properties.

like i got this class CL_WD_TRAY, but not sure how to use it .

if there are any other ways please provide sample code.

regards,

Former Member
0 Kudos

I have given you the best way already using the node and attribute.. ..

Rest what you can do, you need get the reference of the Trays dynamically in the domodifyview and then you need to change the value of that property, this is not the recommended way, because writing code in modifyview increase the load on the application .. I didn't tried this thing too, but i think this can help you.

Kiran_Valluru
Active Contributor
0 Kudos

Hi,

Are you looking for the below code snippet!


DATA lr_tray TYPE REF TO cl_wd_tray.

  lr_tray ?= view->get_element( 'MY_TRAY' ). " Name of your tray

      CALL METHOD lr_tray->set_expanded

        EXPORTING

          value = abap_false.

Regards,

Kiran

Answers (3)

Answers (3)

narendar_naidu
Active Participant
0 Kudos

Thanks all for your replies, will try the logic mentioned.

Regards,

narendar_naidu
Active Participant
0 Kudos

Thank you all for your replies,

issue resolved.

regards,

former_member210804
Active Participant
0 Kudos

Hi Naren,

As Chandra told, create two attributes of property WDY_BOOLEAN and bind those attributes

to each tray accordingly.

Now change the values of those attributes in OnToggle method.

lets say

if tray1 u want to expand, write attr1 = 'X' and attr2 = ' '

if tray2 u want to expand, write attr1 = ' ' and attr2 = 'X'.

Hope it is helpful.

Best regards,

Rao.

former_member195355
Participant
0 Kudos

I think you'll need to bind those trays if you want them to be dynamic...

May I ask why you've chosen not to do this?

narendar_naidu
Active Participant
0 Kudos

Hi Robert,

It is just for good appearance i have created the tray,

Tray 1 for New application

Tray 2 for Renew application

Now when user selects new application, i want to hide renew application.

guide me if i have to bind, again do i need to create a attribute and set the boolean value.

regards,

former_member195355
Participant
0 Kudos

Hi Naren,

Thanks for the clarification and Chandra has given a good reply of what to do - just follow his advice.