‎2008 Feb 17 6:07 PM
Hi Experts,
I have some user defined controls - like buttons, checkboxes, radio buttons on my selection screen.
I want some of these controls to appear and diappear depending on the user login..etc
Please tell me how i do this?
thanks
Dany
‎2008 Feb 17 6:27 PM
Hi..Dan
You can do in this way..
PARAMETERS : p_cid TYPE st_employee-cid modif id A,
check as checkbox modif id B.
if sy-uname = 'user1'.
loop at screen.
if screen-group = 'A'.
screen-active = '0'. " wont be displayed on screen
endif.
if screen-group = 'B'.
screen-active ='0'. "wont be displayed on screen
endif.
modify screen.
endloop.
endif.
if sy-uname = 'user2'.
loop at screen.
if screen-group = 'A'.
screen-active = '1'. " will be displayed on screen
endif.
if screen-group = 'B'.
screen-active ='1'. "will be displayed on screen
endif.
modify screen.
endloop.
endif.
Regards
Sandeep
‎2008 Feb 17 6:27 PM
Hi..Dan
You can do in this way..
PARAMETERS : p_cid TYPE st_employee-cid modif id A,
check as checkbox modif id B.
if sy-uname = 'user1'.
loop at screen.
if screen-group = 'A'.
screen-active = '0'. " wont be displayed on screen
endif.
if screen-group = 'B'.
screen-active ='0'. "wont be displayed on screen
endif.
modify screen.
endloop.
endif.
if sy-uname = 'user2'.
loop at screen.
if screen-group = 'A'.
screen-active = '1'. " will be displayed on screen
endif.
if screen-group = 'B'.
screen-active ='1'. "will be displayed on screen
endif.
modify screen.
endloop.
endif.
Regards
Sandeep
‎2008 Feb 17 7:05 PM
Also, You can create a parameter in table TPARA (SM30 table view TPARA).
Let's say you create a parameter Z_SUPER_USER.
Then you can assing this parameter to the user parameters (SU01). Put it there and put value X
In your code, you can then avoid hard coding the user names, by processing this parameters. In your code you enter something like this (sorry for syntax errors, coded by heart):
In your PBO, you then process something like:
data: l_super_user type char1.
get paramter ID 'Z_SUPER_USER' field l_super_user.
if l_super_user = 'X'.
loop at screen.
if screen-name = '<<<NAME OF THE FIELD/SCREEN ELEMENT>>'.
screen-active = 0.
screen-invisible = 1.
modify screen.
endloop.
endif.
Also you can assign MOD groups to the fields you want to potentially hide. This way, you can hide them all using one command only, like.
loop at screen.
if screen-group1 = '<<<NAME OF THE GROUP>>'.
screen-active = 0.
screen-invisible = 1.
modify screen.
endloop.
endif.
Good Luck,
Leonardo De Araujo