Application Development 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: 

Select-Options under if Condition.

Former Member
0 Kudos
1,647

Hi all,

I have a scenrio where depending upon the logged in user I have to decide whether to display him the parameters screen or not.

That is first I need to check who is looged on and if he's the admin then I should show him the selection screen on the parameters.

Please Guide.

Thank You

1 ACCEPTED SOLUTION

former_member784222
Active Participant
0 Kudos
168

Hi

You can control display / hiding of screen elements in

AT SELECTION-SCREEN OUTPUT event.

Your code should be something like this:

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SY-UNAME = 'ADMIN'.

IF SCREEN-NAME = 'PARAMETER1'.

SCREEN-ACTIVE = 1.

ENDIF.

ELSE.

SCREEN-ACTIVE = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Thanks and regards,

S. Chandra Mouli.

7 REPLIES 7

Former Member
0 Kudos
168

u can submit ur program through another program using the addition

<b>VIA SELECTION-SCREEN</b> for Admin and with out the same for other users,

check for the system field <b>sy-uname</b> to find the user name who logged into ur system currenlty.

former_member784222
Active Participant
0 Kudos
169

Hi

You can control display / hiding of screen elements in

AT SELECTION-SCREEN OUTPUT event.

Your code should be something like this:

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SY-UNAME = 'ADMIN'.

IF SCREEN-NAME = 'PARAMETER1'.

SCREEN-ACTIVE = 1.

ENDIF.

ELSE.

SCREEN-ACTIVE = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Thanks and regards,

S. Chandra Mouli.

Former Member
0 Kudos
168

hi,

case sy-uname.

when 'xxxx'

loop at screen.

if screen-name = 'parameter name'.

screen-output = 0.

endif.

endloop.

when 'yyyy'

loop at screen.

if screen-name = 'parameter name'.

screen-input = 1.

endif.

endloop.

when 'others'

.......

......

endcase.

if helpful reward some points.

with regards,

suresh babu.

Former Member
0 Kudos
168

Hi,

check for the syuname field and accordingly validate it.

Former Member
0 Kudos
168

Hi,

We can not make use of any IF condition in selection-screen.

For this purpose, we have an event AT SELECTION-SCREEN OUTPUT.

Write the following lines of code.

  parameters : p_one type c,
                     p_two type c.

  at selection-screen output.
     loop at screen.
        if screen-name CP '*P_ONE*'.
           if sy-uname = 'NTWDEV'.  "<-- Admin user name
             screen-active = 1.
           else.
              screen-active = 0.
           endif.
           modify screen.
        endif.
     endloop.

Regards

Sailaja.

Former Member
0 Kudos
168

Hi,

You can put the validation in at selection-screen output event. use:

Loop at screen.

if screen-name eq <parameter> and sy-uname ne <admin>.

screen-active = 0.

endif.

modify screen.

endloop.

Thanks

sandeep

Reward if helpful

Former Member
0 Kudos
168

Thanks for the replies