Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Menu

Former Member
0 Likes
1,090

Hi,

I want to create a menu, but without using the menu painter. I want to create it dynamically from

the source code, so I can make changes in runtime. Someone knows how to do it?

Regards,

Isaac Meléndez

8 REPLIES 8
Read only

Former Member
0 Likes
953

hi,

can you elaborate your requirement.

You can change the Menu dynamically.But even though you should use menu painter only.

If you tell urrequirement in detail, can provide solution.

Regards

Sandeep Reddy

Read only

0 Likes
953

Hi Sandeep,

I need to change the menu view for different users. But I need to do it dynamically, I can change

the texts of the menu functions, but I can´t change the code of the functions. How can I do that?

I use the menu painter and declare my menu elements as dynamic, but with this I only change

the text. Or maybe just with hiding the elements of the menu I can solve my problem. Any idea?

Regards,

Isaac Meléndez

Read only

Former Member
0 Likes
953

Hi,

try like this.

You want to change your menu depends on User Name, rite?

first declare one internal table like this :

data : begin of itab1 occurs 0,

fcode(10),

end of itb1.

data : begin of itab2 occurs 0,

fcode(10),

end of itb2.

iatb1-fcode = 'SAVE'.

append itab1.

itab1-fcode = 'EXIT'.

APPEND ITAB1.

ITAB2-FCODE = 'CANCEL'.

APPEND ITAB2.

ITAB2-FCODE = 'GOTO'.

APPEND ITAB2.

CASE SY-UNAME.

WHEN 'USER1'.

SET PF-STATUS MENU1 EXCLUDING ITAB1.

WHEN 'USER2'.

SET PF-STATUS MENU1 EXCLUDING ITAB2.

WHEN 'USER3'.

SET PF-STATUS MENU2.

ENDCASE.

Functionality :

if user1 enters, then wat evr is appended in itab1, will be disabled.

SAVE and EXIT (fcode in menu1).

If user2 enters, then wat evr is appended in itab2, will be disabled.

if user3 enters, then different menu, that is another menu named MENU2 will be displayed.

hope it helps you.

<REMOVED BY MODERATOR>

Regards

Sandeep reddy

Edited by: Alvaro Tejada Galindo on May 22, 2008 4:38 PM

Read only

0 Likes
953

Hi Sandeep,

I try the code and only disabled the items, do you know how can I made them invisible or hide them?

Regards,

Isaac Meléndez

Read only

Clemenss
Active Contributor
0 Likes
953

Hi,

a useful and flexible alternative is to use the TOOLBAR grid control.

Most GUI controls have the toolbar integrated with a default set of functions. You can change this at runtime, create context menus and what ever you want.

Regards,

Clemens

Read only

Former Member
0 Likes
953

Hi,

But my requirement is explicit that has be done in the menu part of the transaction.

Thanks.

Regards,

Isaac Meléndez

Read only

Former Member
0 Likes
953

Hi,

If I create the menu bar with the menu painter. After that, can I add or remove items

with a function or something?

Regards,

Isaac Meléndez

Read only

Clemenss
Active Contributor
0 Likes
953

You can not add items later, because menu is static. You can disable functions by SET STATUS ... EXCLUDING...

Regards,

Clemens