cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide menu item action in a menu

Former Member
0 Kudos

Hi All,

I have a textview ui element, in that I inserted a menuitem. Inside that menu item I created two menuitem actions.

Now I want to hide one menuitemaction.To do this, menuitem action doesnot have "VISIBLE" property.

How to hide that menu item action in a menu

This is my problem.

Can anyone tell me how to hide that menu item action in a menu.

Thanks in Advance!

Edited by: sreelakshmi.B on Jul 10, 2009 2:48 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I created a test application for your issue....the only option we get is to enable/disable the menuactionitem...the other option would be to create these actions dynamically...so depending on some condition...we create one but not the other...and vice versa....

hope this helps...

Thanks...

AS.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I am not sure if you already know this or not....but here is the code to do that:

in WDDOMODIFYVIEW, I have following:

if some_condition = abap_true.

DATA lr_action_item TYPE REF TO cl_wd_menu_action_item.

DATA lr_menu TYPE REF TO cl_wd_menu.

lr_menu ?= view->get_element( 'MENU' ).

CALL METHOD cl_wd_menu_action_item=>new_menu_action_item

EXPORTING

id = 'OPTION'

text = 'OP1_1'

view = view

RECEIVING

control = lr_action_item.

lr_menu->add_item(

EXPORTING

index = 3

the_item = lr_action_item ).

ENDIF.

Just want to let you know that the "id" should be unique....in my test application I am creating only one action item so I kept it static....but you can create a counter variable (global, under the attribute tab)....and keep appending the counter with the "id" name....what i mean is this:

under the attribute tab create a counter of type N.

than

concatenate 'OPTION' counter into lo_id

lo_id is of type string.

this counter value can be increased by "1" everytime you create one action item.

for "text"...this is the text you want to show to the user under the menu item....

hope this helps....

Thanks...

AS.

Former Member
0 Kudos

Thanks for your reply.

As per your advice, I created menu items dynamically and I got the solution for my requirement.

Thanks!

Former Member
0 Kudos

THANKS!