‎2008 May 22 5:33 PM
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
‎2008 May 22 6:26 PM
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
‎2008 May 22 6:42 PM
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
‎2008 May 22 7:13 PM
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
‎2008 May 22 7:29 PM
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
‎2008 May 22 7:37 PM
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
‎2008 May 22 8:59 PM
Hi,
But my requirement is explicit that has be done in the menu part of the transaction.
Thanks.
Regards,
Isaac Meléndez
‎2008 May 23 6:00 PM
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
‎2008 May 24 6:20 PM
You can not add items later, because menu is static. You can disable functions by SET STATUS ... EXCLUDING...
Regards,
Clemens