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

Check Box Selection

Former Member
0 Likes
2,327

Hi experts,

I Have A Requirement That..I Have Created A Check Box ....

Parameters: P_c As Check Box Default 'X'.

So Can We Assign the Authorization For That Check Box.....Means Only 'ABAP'  And   'HBTABAP'   Can Un Tick That..Check Box .Means Only Those 2 Users can Have That access To Disable That Check Box tick mark...Can You Help Me out Of This Experts..

Regards,

uday..

1 ACCEPTED SOLUTION
Read only

asim_isik
Active Participant
0 Likes
1,788

hi ,

at selection screen output.

loop at screen.

     if sy-uname ne 'ABAP' or sy-uname 'HBTABAP' .

          if screen-name cs 'p_c'.

               screen-active = 0.

          endif.

     endif.

modify screen.

endloop.

13 REPLIES 13
Read only

Former Member
0 Likes
1,788

Hi Uday,

you can make use of event at selection screen output.

in this event put a condition as below.

if sy-uname = 'ABAP' OR 'HBTABAP' .

     loop at screen.

          if screen-name = p_c.

               screen-disable = 'X'.

               modify screen.

          endif.

     endloop.

else.

     loop at screen.

          if screen-name = p_c.

               clear screen-disable.              

               modify screen.

          endif.

     endloop.    

endloop.

Please publish if you face any issues on the same

Regards,

Bhaskar

Read only

0 Likes
1,788

Hi sir,

when i am trying to do that i am facing the below mentioned problem..

1. incorrect logic expression

2. The data object "SCREEN" does not have a component called "DISABLE".

Read only

0 Likes
1,788

check with sCREEN-INPUT eq 0

Read only

0 Likes
1,788

Hi Uday,

check with

screen-active or screen-input.

Please publish if you still face issues.

Thanks,

Bhaskar

Read only

0 Likes
1,788

hi Sir,



p_chk = 'x' ..by default tick mark is there..so only ajit and sawant user's can untick ...it


so mine is abap when i am untick it it is happening..below is the code i have developed as you said..but it is not working.


AT SELECTION-SCREEN OUTPUT.
if sy-uname = 'SAWANT' OR SY-UNAME = 'AJIT'.
   ELSE.
      loop at screen.
           if screen-name CS p_chk.
           SCREEN-INPUT = 0.
           modify screen.
          endif.
     endloop.
endif.



regards,

uday



Read only

0 Likes
1,788

Hi Uday,

I suggest you to check in debugging, so you are sure that it is not working. then keep a break point at IF statement , then it will be stopped at that point and you can execute statement by statement.

then you will be able to know at which point it is failing.

Let me correct the code here,

if screen-name CS p_chk this line should be like below

IF_SCREEN-NAME = 'P_CHK'.

let me tell you reason, you are checking the screen-field name whether it contains P_CHK or not. we dont bother about the value in p_chk at this point of time.

Happy learning dude.

Regards,

Bhaskar

Message was edited by: bhaskar doppalapudi

Read only

rosenberg_eitan
Active Contributor
0 Likes
1,788

Hi,

May I suggest that you use AUTHORITY-CHECK.

That way you do not have to hard code user names in the program.

if 'ABAP' and 'HBTABAP' are developers you can use developer specific authorization objects.

You can also create your own authorization objects.

Regards.

Read only

Ajit_K_Panda
Product and Topic Expert
Product and Topic Expert
0 Likes
1,788

Hi Uday,

If the list of user fixed for ever that these two user will can do this, then you can hard code the user's name and write code accordingly in AT-SELECTION SCREEN OUTPUT. For that you have to use Loop at screen statement as mention by Bhaskar. Check the SCREEN table for attributes of input fields.

If in future the list of user, who can untick the check box, may change then it's better you use authority check.

IF the user's fall into a particular role, then you can create a authorization object and assign it to that role. Then you can check the authorization object in your program to achieve this functionality.

Regards,

Ajit

Read only

nishantbansal91
Active Contributor
0 Likes
1,788

Hi uday,

Instead of the showing the check box to other user make them invisble.

if sy-uname ne 'ABAP' or sy-uname ne 'HDABAP'.

use the loop at screen and set the use the Visible and invisible field .

endif.

Regards.

Nishant Bansal

Read only

asim_isik
Active Participant
0 Likes
1,789

hi ,

at selection screen output.

loop at screen.

     if sy-uname ne 'ABAP' or sy-uname 'HBTABAP' .

          if screen-name cs 'p_c'.

               screen-active = 0.

          endif.

     endif.

modify screen.

endloop.

Read only

Former Member
0 Likes
1,788

TRY THIS,
**************************

PARAMETERS: p_c AS CHECKBOX DEFAULT 'X'.

DATA: abap TYPE sy-uname VALUE 'ABAP'.

AT SELECTION-SCREEN.

   AUTHORITY-CHECK OBJECT 'P_C' FOR USER abap id ' ' DUMMY.

   IF sy-subrc NE 0 .

     LOOP AT SCREEN.

       CLEAR screen.

       MODIFY SCREEN.

     ENDLOOP.

   ELSEIF sy-subrc <> 0.

     MESSAGE 'No authorization' TYPE 'E'.

   ENDIF.

Read only

Former Member
0 Likes
1,788

Thank You All For Your valuable Suggestions...

Below is the code i Have developed...as per My Requirement..

So the users abap and hbtabap only can view the check box and can untick that remaining all users can view this in dispaly mode..

AT SELECTION-SCREEN OUTPUT.
   IF sy-uname EQ 'ABAP' OR sy-uname EQ 'HBTABAP' .
   ELSE.
     LOOP AT SCREEN.
       IF screen-name CS 'p_chk'.
         screen-input = 0.
         MODIFY SCREEN.
       ENDIF.
     ENDLOOP.
   ENDIF.

Read only

Former Member
0 Likes
1,788

My code must be working. Try it!!