How do I check authority for a screen element

Hello friends,
I've been assigned to work on the following problem:
In an ABAP  program, in fact PAI of a screen, I must add the authority check for a screen element (which is based on a Z table element).
That is to say, some users must be allowed to edit the screen element, while the others are only allowed to display.
I was told to look at the AUTHORITY-CHECK statement. It talks about ID and FIELD and other stuff. I find this statement very cryptic and I have no idea what these things are and how to use them. So the questions are:
1) Can I use it to restrict the ability of changing contents of a screen element?
2) If yes how do I do it? That is to say, what ID, FIELD, value, etc. do I use?
3) If not, how else can I do this?
Your help is greatly appreciated.

Hi Goharjou,
Answers to your questions:
1) Can I use it to restrict the ability of changing contents of a screen element?
Yes you can use AUTHORITY-CHECK to restrict the ability of changing contents of a screen element.
2) If yes how do I do it? That is to say, what ID, FIELD, value, etc. do I use?
Let me explain you with an example. Assuming your screen field is ZTABLE-COLOR and will have values such as 'GREEN', 'BLUE', 'RED', etc.
Depending on the authorization of the current user, you can restrict the access such as 'CREATE', 'CHANGE' and 'DISPLAY'. Let us talk about creating an authorization object later. First let us assume that there is an authorization object you have created named 'ZAUTH_COLOR' with two fields 'COLOR' and 'ACTVT'. The field 'ACTVT' is a standard SAP feature for checking the above authorization. The possible values are '01' (Create), '02' (Change) and '03' (Display). The field COLOR is your field we spoke earlier.
In the PAI event, you will check authorization through the following statement (for example you want to check whether current user has got change authorization for the color entered):
AUTHORITY-CHECK OBJECT 'ZAUTH_COLOR'
  ID 'COLOR' ztabe-color                                     "This will be color entered by user
  ID 'ACTVT' '02'.                                                 "Change authorization
IF sy-subrc NE 0.
*& Here do whatever you want like setting a flag and
*& later in the PBO event, disable some functions / screen-elements
*& Or raise an error message straight away
*& or raise an information message and remove whatever color
*& user has entered for which authorization is not there 
ENDIF.
Now let us talk about how the authorization object will be created and how system knows that the current user has such-and-such authorization for the color in subject:
Through SU21 tcode, you will create the authorization object ZAUTH_COLOR with two fields
   (1) COLOR
   (2) ACTVT
Maintain possible activities checking all of them '01', '02', '03'.
Provide the above information to your BASIS administrator. Your Basis admin will assign this authorization object to the user through roles and assign appropriate values for the user profile. e.g. user1 will have authorization for only ACTVT='03' (Display), user2 will have ACTVT=* (all activities), etc. As a developer, you dont have to worry about this. All that you need to do is create the auth-object, communicate to the administrator and change your program to incorporate AUTHORITY-CHECK statement.
3) If not, how else can I do this?
Not applicable
Hope the above helps you and solves your problem.
Regards
Suresh Radhakrishnan

Similar Messages

  • How to give error message for the screen element text field when wrong i/p

    How to give error message for the screen element text field when wrong i/p
    when wrong input given
    eg. 
    I have a text box with SBOOK-CARRID
    so when user give wrong entry in text box i.e LG
    then I should give some error stating that the the input is invalid or not available ,
    now it showing the error of standard messages,
    i want manual message to be displayed when error comes.
    Thank you,
    Regards,
    Jagrut Bharatkumar Shukla

    Hi all,
    Thank you for your valuable reply,
    but the thing is that its a screen field,
    i.e text box not a selection screen
    i created in screen layout
    with name sbook-carrid
    now i want to get error message display if wrong i/p is given
    thank you.
    Regards,
    Jagrut bharatkumar Shukla,

  • How to create a parameter id on screen element

    How to create a parameter id on screen element
    reply urgent

    Hi Madan,
    Check this info.
    Parametere Id is the one which holds the memory for the particular field. when we need to pass the the field from one screen to another use the parameter Id.
    The SAP Memory is a user-specific memory area of the application server, which is accessed by all main sessions of a user session at once. ABAP programs have access to SPA/GPA parameters stored in the SAP Memory (also called SET/GET parameters).
    Eg. Of  how to use Set parameter
    you can give value of variable (dobj) to parameter ID 'pid'. This will store value in SAP memory
    SET PARAMETER ID pid FIELD dobj.
    When you want to use that value stored in SAP memory
    you can use GET parameter.
    GET PARAMETER ID pid FIELD dobj.
    To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
    ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
    To fill one, use:
    SET PARAMETER ID <pid> FIELD <f>.
    This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
    To read an SPA/GPA parameter, use:
    GET PARAMETER ID <pid> FIELD <f>.
    This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.
    To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.
    The relevant fields must each be linked to an SPA/GPA parameter.
    On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.
    Check this link.
    http://help.sap.com/saphelp_47x200/helpdata/en/f5/6a853c61c5140ee10000000a11405a/frameset.htm
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Offline unlock key--how do I get one for a Premier Elements 13 component?

    Offline unlock key--how do I get one for a Premier Elements 13 component?

    K, Again thanx, that is exactly what I've done and it does not work.  I cannot get an unlock key using the SN provided by the offline PC, and then pasting it into http://www.adobe.com/go/premiereel_encoder  per instructions on screen and now even by telecom from Adobe.  Bob
    Adobe - Error pageEurope, Middle East and Africa
    View on www.adobe.com
    Preview by Yahoo

  • How to create a variant for a screen (not a selection screen)

    Hi
    I foud a function module RS_CREATE_VARIANT.
    Is this the correct fm for creating screen variant, if yes then pls provide me some help about how to pass values to this fm.
    if not then pls help me to find out new one.
    thnks
    satisfactory answer will be definitely rewarded.
    S@meer

    passing values to RS_CREATE_VARIANT.
    data : LS_VARIANTDESC TYPE VARID.
      DATA : LT_VARIANTTEXT TYPE TABLE OF VARIT ,
             WA_VARIANTTEXT TYPE VARIT.
      DATA : TT_REPORTPARAM TYPE TABLE OF  RSPARAMS,
             WA_REPORTPARAM TYPE RSPARAMS.
    CLEAR LS_VARIANTDESC.
              LS_VARIANTDESC-MANDT   = SY-MANDT.                " gr 46A
              LS_VARIANTDESC-REPORT  = 'ZXXXXX'.
              LS_VARIANTDESC-VARIANT = 'VARIANT'.
              LS_VARIANTDESC-EDAT    = SY-DATUM.
              LS_VARIANTDESC-ETIME   = SY-UZEIT.
              REFRESH LT_VARIANTTEXT.
              CLEAR WA_VARIANTTEXT.
              WA_VARIANTTEXT-MANDT    = SY-MANDT.               " gr 46A
              WA_VARIANTTEXT-LANGU    = SY-LANGU.
              WA_VARIANTTEXT-REPORT   = 'ZXXXXXX'.
              WA_VARIANTTEXT-VARIANT  = 'VARIANT'.
              APPEND WA_VARIANTTEXT TO LT_VARIANTTEXT.
           CALL FUNCTION 'RS_CREATE_VARIANT'
                  EXPORTING
                    CURR_REPORT               = 'ZXXXXX'
                    CURR_VARIANT              = 'VARIANT'
                    VARI_DESC                 = LS_VARIANTDESC
                  TABLES
                    VARI_CONTENTS             = TT_REPORTPARAM
                    VARI_TEXT                 = LT_VARIANTTEXT
                  EXCEPTIONS
                    ILLEGAL_REPORT_OR_VARIANT = 1
                    ILLEGAL_VARIANTNAME       = 2
                    NOT_AUTHORIZED            = 3
                    NOT_EXECUTED              = 4
                    REPORT_NOT_EXISTENT       = 5
                    REPORT_NOT_SUPPLIED       = 6
                    VARIANT_EXISTS            = 7
                    VARIANT_LOCKED            = 8
                    OTHERS                    = 9.
                IF SY-SUBRC EQ 7.
    If variant with same name already exists, change variant
                  CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
                    EXPORTING
                      CURR_REPORT               = 'ZXXXXX'
                      CURR_VARIANT              = 'VARIANT'
                      VARI_DESC                 = LS_VARIANTDESC
                    TABLES
                      VARI_CONTENTS             = TT_REPORTPARAM
                    EXCEPTIONS
                      ILLEGAL_REPORT_OR_VARIANT = 1
                      ILLEGAL_VARIANTNAME       = 2
                      NOT_AUTHORIZED            = 3
                      NOT_EXECUTED              = 4
                      REPORT_NOT_EXISTENT       = 5
                      REPORT_NOT_SUPPLIED       = 6
                      VARIANT_DOESNT_EXIST      = 7
                      VARIANT_LOCKED            = 8
                      SELECTIONS_NO_MATCH       = 9
                      OTHERS                    = 10.
                ELSEIF SY-SUBRC NE 0.
                MESSAGE WITH 'Cannot create/change variant for'
                SY-UNAME.
                ENDIF.

  • How to put Mandatory option for selection screen fields in ABAP Queries

    Hi Experts
    Can anyone tell me how to put mandatory option for the selection screen fields in ABAP Queries.
    Manually I had written code in the At Selection Screen  option in infoset to display error message if that field is blank.
    But I need to display the selection fields with the tick mark (obligatory mark).
    How to do this?
    Appropriate answers will be awarded

    Hi
    For parameter option
    parameters : p_kunnr type kna1-kunnr  obligatory.
    For select option
    select-options: s_date for vbak-erdat obligatory.
    Plz rewards points ,
    Regards ,
    Ganesh.

  • How to programmatically resize vi for different screen resolutions ?

    Hi,
         I have been struggling with this,How can i built a vi that should run for different screen resolutions (on different pc's).
    There are several threads on forum , But i dont find the exact solution for it.
    I have already tried with VI properties in the VI but i dont think its working.
    Can someone please help me ?
    Thanks and regards,
    Shivkant Paswan

    Yup it is a pain to use panes, but that is the easiest method I've found which meets my requirements.  Learn to use panes and splitters effectively, and then learn their limitations and workaround when you find those limitations.  In general LabVIEW should handle multi-resolutions, and resizing better but these are the tools we have today.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to get check number for the employee's paycheck

    Hello
    Anyone can advise on how to get the check number for an employee's pacheck
    I got employee first name,last name,GROSS salary,Tax Info,and NET salary.I need the CHECK NUMBER.
    please advise
    thanks
    kp
    Edited by: user8612301 on Dec 16, 2010 1:26 PM

    Hi,
    Or are you looking for this:
    SELECT serial_number, paaf.assignment_number
    FROM pay_assignment_actions paa, per_all_assignments_f paaf
    WHERE action_status = 'C'
    AND paaf.assignment_id = paa.assignment_id
    AND serial_number IS NOT NULL
    AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date;
    - Viky
    Edited by: Viky on Dec 17, 2010 11:42 AM

  • I think my email was hacked from my iPad how can I check it for viruses

    I think my e mail was hacked from my iPad. How can I check the iPad for viruses?

    Well there are apps for that, but iPads and others are not suseptable to viruses, if they are its very very very small number. So I would suspect that you are fine, but check the app store for an app that would scan for viruses, i use Virusbarrier to scan downloads i get in emails, or links.

  • How to create Check table for Field Maktx

    Hi Experts,
    I am create one ztable with fields Mandt, Matnr, Maktx, Type1 and Type2 etc.
    I need a create a check table for field MAKTX.
    If i give material number the its the material description also.
    Thanks in Advance,
    Purnaneelu.

    Hi,
    Actually i am create one ZTable with fields Mandt ,matnr, maktx, type1,type2 and type3
    Now i am entry the data for matnr,type1,type2 and type3 .
    Now i am going to TCode SE16n material is not appears, but the requirement is shows the description also
    STOP USING I AM in each and every sentence...and try to correct your english...so that people can understand your problem easily.
    Hope this suggestion will help you going forward at the time of posting your question at SDN.
    Wram regards,
    Abhishek

  • How to set default variant for selection screen

    Hi,
    I want to make one variant as default for selection screen for one user.
    For eg., take COOIS. For the selection screen, i have 3 variants. But i want one variant to be default. Thsi is not for all users. Thsi is for particular user.
    I am not seeing any way to do this. please help me..
    Thanks
    Srini

    Hi,
    If you are using Z program then you can ask your developer to get Variant name Runtime from Parameter ID.
    This means you decide a Parameter ID name : ZVAR in your Z program and ask your developer to load variant each time your Z program loads.
    Now, second step will be using SU01 transaction you can set value of ZVAR in Parameters tab for the user. This value will be the variant which you created for this user.
    This will solve your problem and you can make n number of variants and assign it to different users.
    Regards,
    Arpit

  • How to install content cd for Adobe Premiere Elements 10?

    I am unable to install the content cd for Adobe Premiere Elements 10. Please help.

    I removed the programs from my computer and reinstalled them. I installed
    both Adobe Photoshop Elements 10 and Adobe Premiere Elements 10 from disk
    1. Then I installed all of the content folders from disk 4 (content).
    When I open the Premiere Elements Program a dialogue box asked if I wanted
    to add content, I checked yes and an internet site opened and I was able to
    download the content.
    There must have been something wrong with my original installation of the
    program as this didn't happen before.
    Thank you so much for your assistance and your kind patience.
    Theresa

  • How to find Annual Budget for a WBS element ?

    Hi All ,
    Is there any way by which i can find the annual budget for a WBS element ?
    I have been working on this for a long time , but couldnt get the answer .
    So getting back to this place .
    Thanks in advance .
    Regards,
    Ambar .

    Hi,
    This link may help you.
    how to get the budget amt and commited amt and available amt?
    Regards,
    Shamma

  • How to add check box to list screen in SYCLO Agentry?

    Hi,
    How can I add a check box to the list screen. I want to add a new column which allows the user to select the check box.
    I have tried with "Allow Multi-Row Select" option. When I selected this option I am getting an error
    "The For Object defined for the "Transmit" action is invalid. 'None' is not a valid choice since the Multi-Row Selection option for the list screen is enabled."
    -Shyam

    Is the list screen in transaction screenset or Object?
    You can't use the field type button in a list screen.  But what you can do is take a 16 x 16 image, with a checked box not checked.
    Users will not be able just to check the box to enable it or not.  You need to have an action linked to a button to the selected row, or you can have an action fire if the user double checks the row.
    Stephen

  • How to create Context Menu for Full Screen ALV

    Dear Experts,
    Please tell me the procedure to create Context Menu for ALV Grid (full screen ALV using SLIS ).
    Regards
    Arnab

    Hi,
    Check the demo program BCALV_GRID_06

Maybe you are looking for

  • HELP Can you see the missing parenthesis ?!

    Dear People, I am doing a simple program that creates a ContactBook and allows keyboard entry of lastName, telephoneNumber and emailAddress. I have a few error messages that say parenthesis missing but I don't see any missing ! : "Note.java": Error #

  • Bug in Config Data Source Parameter on Content presenter

    Hi all, I find out a bug when we configure Data Source parameter on Content Presenter at run-time. Example: I configure the value for Data Source is: ${'SELECT * FROM ora:t:IDC:Profile:TinbaiProfile WHERE ora:p:xmNgayxuatban < TIMESTAMP \''}${pageFlo

  • Re-Setting phone setting with a broken screen???

    Hi, Is it possible to re-set the original factory setting on my Curve 8900 with a broken screen? I'm wanting to sell it on ebay but not with all my personal stuff on. Thanks Phil

  • When is synchronization required?

    My application runs a number of threads inside a Tomcat server, each of which is updating a replicated cache (checking for pre-existing entries in some cases). I have been getting irregular problems in the classloader - apparently due to what seem to

  • Ipad mini lost wifi connectivity after 8.1

    Can no longer connect on my ipad mini to wifi after installing 8.1.  Tried all the recommended fixes such as rebooting, resetting network settings, even resetting the ipad.  Nothing.