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

Handle selection screen controls based on users

Former Member
0 Likes
407

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
390

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

2 REPLIES 2
Read only

Former Member
0 Likes
391

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

Read only

0 Likes
390

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