Authority-Check in ABAP Query

Hello,
        I have a requirement to add authority check on two fields "Sales Organization" & "Plant" in a ABAP Query.
Please let me know how can I do it?
Will I be required to add some "Authority-check" code in sq02 or is there any button/checkbox available to do the same.
Please let me know.
Thanks in advance.
Best regards,
Tejas Savla

Hi Ronak,
Check this thread, this might help you.
Authorisation on field
Regards,
Chandra Sekhar

Similar Messages

  • Authorisation check in ABAP Query..

    Hi Gurus
      Can we put Authorization check in ABAP Query ?
    Your help is appreciated.
    Regards,
    Gajanan

    Hi,
    Please check this online document on how to setup authorization for SAP query.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    Regards,
    Ferry Lianto

  • Authority Check to a Query

    HELLO,
    I am trying to introduce an authority check in a query, to do this I use the SQ02 transaction but I have 2 problems:
    1.- I can't change the At selection-screen module
    2.- If I change the Start Of Selection, then I save the code and finally I generate the infoset but I can`t see the modifications in the query.
    Do you Know what can I do to solve this problem?
    Thanks

    I think you don`t understand me.
    I have put ZTCO_SOLTRAS_CAB-BUKRS in the GoTo ..., it works correctly, but it is not my problem. My problem is:
    before I modified the query, the query read the field SP$00001(a select options) and get all the bukrs between the SP$00001-low and the SP$00001-high . Then I had to put a new field s_bukrs in the selection screen and now the user put the bukrs in muy new field, in that way I can check the authrity perfectly; so up to now all is correct...
    but the problem arrives in order to show the query results,  it doesn't matter what values fill the user in my field (s_bukrs) because the query still uses the SP$00001 field to filter data.
    An example:
    The user introduces the values 'A41' in the SP$00001-low and 'A43' in the SP$00001-high.
    I get those values and I check the authority. Imagine tha the user can see all the bukrs and the query goes on.
    Here is the problem!!!!!!!!!!! The query continuous (and it was code so) and in order to show the bukrs, goes to the field SP$00001 to filter data.( I can´t modify this code....) SP$00001 is empty so the query shows all the bukrs and the user only want to see bukrs between A41 and A43
    Do you understand me now?
    Thanks a lot, yo are helping me a lot!

  • Authority check in ABAP program

    Hello All
    I am having some trouble with authority object in ABAP programming
    This is the situation.
    I have a field "plant" which is a select options in the selection screen.
    I have to write an authority-check for this "plant" field in the program and display the report for only the plants for which the user is authorised. There is a select statement in the program which selects all the plants entered. If it is single plant entry and the user is not authorised or the user is not authorised to none of the plants entered for multiple plant entries, an error message should be displayed saying "no authority to display plants x, y, z"
    How can I incorporate this logic in the report.
    This the current coding
    AT SELECTION-SCREEN.
    AUTHORITY-CHECK OBJECT 'C_ROUT'
              ID 'ACTVT' FIELD '03'
              ID 'PLNTY' FIELD 'DUMMY'
              ID 'WERKS' FIELD s_werks
              ID 'STATU' FIELD 'DUMMY'
              ID 'VERWE' FIELD 'DUMMY'.
    START-OF-SELECTION.
      SELECT amatnr  aplnnr aplnal awerks aplnty bstlnr b~stlal INTO TABLE t_mapl FROM mapl AS a INNER JOIN mast AS b
                               ON amatnr = bmatnr
                                AND awerks = bwerks
                             WHERE a~matnr IN s_matnr
                                   AND a~plnnr IN s_plnnr
                              AND a~plnal IN s_plnal
                            AND a~werks IN s_werks
                           AND a~plnty IN s_plnty
                           AND b~stlnr IN s_stlnr
                             AND b~stlal IN s_stlal. "(ALT BOM)
    Thanks
    Ricky

    Hi Ricky,
    to check each individual plant in the selection, you can not use s_plant in the authority chek, here you need to give the value..
    Code like this:
    DATA : BEGIN of t_werks OCCURS 0,
                  werks TYPE t001w-werks,
    END OF t_werks.
    DATA : w_text(30) TYPE c.
    AT SELECTION-SCREEN.
    IF NOT s_werks[] IS INITIAL.
    REFRESH t_werks.
    SELECT werks
    FROM t001w
    INTO TABLE t_werks
    WHERE werks IN s_werks.
    IF sy-subrc EQ 0.
    LOOP AT t_werks.
    AUTHORITY CHECK...
    ID 'WERKS' FIELD t_werks-werks.
    IF sy-subrc EQ 0.
    DELETE t_werks.
    ENDIF.
    ENDLOOP.
    IF NOT t_werks[] IS INITIAL.
    LOOP AT t_werks.
    CONCATENATE t_werks-werks
                             w_text
                    INTO w_text.
    ENDLOOP.
    MESSAGE exxx WITH 'No authorisation for '
                                      w_text.
    ENDIF.
    ENDIF.
    ENDIF.
    Thanks and Best Regards,
    Vikas Bittera.
    **Reward if useful**

  • How to use the AUTHORITY-CHECK in ABAP

    I am a security guy but am trying to understand how the AUTHORITY-CHECK works. I have read the help on it but it doesn't answer to my understanding. I want a check in a report so that no matter what the user selects the program goes out and checks the authorization in the users master record and only displays what he has access to. I am sure this is basic but I am not a programmer.
    Thanks

    Hi Greg,
      Basically a AUTHORITY-CHECK is a programmatic way to check a auth object a user has.  This is only as good as the person writing the code makes is.
    Here is a basic example of how it could work.  Lets say you have auth objects for users that limit them to see company code. User A can see cc 10, User B can see cc 20 and user C can see both.
    In the code the programmer would have to first do the authcheck to see what CC the user has access to.  Then they would have to limit his reporting based on the results of the authority check.  So they might do it by saying SELECT * FROM XYZTAB WHERE COMPANY CODE = AUTHCC
    This is what I think you are looking for.  There are other ways to use the auth check.  You can do a check and end the program with a message if they don't have authorization. 
    If you need more info, let me know
    John

  • Authority check in infoset query for field with multiple entries

    how can i perform the authority check in sq02 "at selection screen" for a multiple entry field
    e.g. EKORG low  0001 - high  0005
    or EKORG 0001, 0004, 0005
    I already added the following statements
    How the field for EKORG check must be filled
    if EKORG is initial.
      message 'Bitte Einkaufsorganisation wählen' TYPE 'E'.
    endif.
    AUTHORITY-CHECK OBJECT 'M_BEST_EKO'
             ID 'ACTVT' FIELD '03'
             ID 'EKORG' FIELD ?????.
    IF sy-subrc = 4.
      MESSAGE 'Keine Berechtigung für EKORG  sy-subrc 4'  TYPE 'E'.
    ENDIF.

    hi,
    which event do you use for your coding ?
    it must be AT SELECTION-SCREEN
    A.

  • RE: Authority checks included in the info set of the query

    Hi all,
    I am checking the program code for one of our custom tcodes and i asked ABAP team to add authority check to the program code because there is no auth check in the code and abapers told me that the authority check is included inside the info set of the query and not in the program . the program is used to execute the query in the Tcode.
    how to find the Authority checks included in the info set of the query.
    Thanks in advance,
    Sun.

    If you have the BI support roles assigned to you  and the security admin  roles please login to the BI system
    execute transaction RSECADMIN, click on the analysis tab and execute as the user who is assigned the role with restrictions.
    For variables in authorizations like ( type customer exit )
    use RSECADMIN - maintain authorization tab - Click on value authorization tab.
    Keytransaction is RSECADMIN  & infoobject maintenance details you can get from RSD1.
    Regards

  • SQ01 -  Include a check box on ABAP query Selection screen

    Hi Experts,
    For my Abap Query, on the selection screen i am planning to include a check box such that if i click on the check box then a field will be displayed in the resulting output . On the other hand if i do not check on i should not be able the field in the output.
    Please tell me how do i do this.
    Thanks
    Venkata Pradeep.

    In infoset, Extras code tab
    Code section: At selection-screen output
    Do something like below:
      IF radiobutton1 = 'X'.    
         LOOP AT SCREEN.      
              IF screen-group1 = 'XXXX'.         "XXX is the filed group name you want to hide., you have to                                                                  find out what is it.
                   screen-input = '1'.        
                   screen-invisible = '0'.        
                   MODIFY SCREEN.      
              ENDIF.    
         ENDLOOP.  
    ELSE.   
         LOOP AT SCREEN.     
              IF screen-group1 = 'XXX'.        
                   screen-input = '0'.       
                   screen-invisible = '1'.       
                   MODIFY SCREEN.     
              ENDIF.   
         ENDLOOP. 
    ENDIF.

  • Validate plants selected in Abap Query selection screen

    Hi Everyone,
    I have a requirement wherein i have to validate 'authority check' for the plants populated in the selection screen in an already created abap query.
    I tried adding code in the code section. But i dont know how to use the select-option parameter. It already exists(VBAP-WERKS) in the table which is used for join, so i cannot add it in the additional fields. Am i correct ?
    Also, i saw that the report program for this query uses this parameter sa SP$00008. I tried using it but it gives an error The IN operator with "SP$00008" is followed neither by an internal table nor by a value list.
    Please help.
    Also, please advice whether this requirement can be catered in this query alone? or should i go with writing a new report program for this? ( i personally feel that this would beat the purpose of using Abap Query. )
    Regards,
    Tarun

    Hi Tarun,
    I am still not clear with the problem..I guess you require plant in your selection screen which you have.
    i guess if you go to sq01tcode there is a option infoset query from where you can give your selection options and value.
    have you selected all the fields in infoset and made a selection screen?
    When you have done with your infoset you just need to diplay the fields and there is a automatic program generated.
    Let me know...
    Regards,
    Nihkil.

  • User authorisation check in ABAP-HR program

    Hi,
    Can anyone please help me on the following query ?
    I need to check user authorisation in an ABAP report at Object level, filter only relevant records based on the user's authorisation and display appropriate messages.
    The above mentioned report is purely developed by us and is not a copy of any standard report. Hence, kindly help me with your suggestions and opinions.
    Thanks and Regards,
    Manas Menon

    Create an authorisation object (SU21)
    Put an authorisation check for this object in your report (AUTHORITY-CHECK)
    Create a role that contains this object (PFCG)
    Assign this role to all the users who require access to the report (SU01).
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 27, 2008 2:07 PM

  • Authorization for ABAP Query

    Hello all,
    Can I benefit a little from your experience with SAP Query(ABAP) and Adhoc Query(ABAP)?
    My customer want to use both SAP Query and Adhoc Query.
    And they want to separate for SAP Query as preset report program and Adhoc Query as general-purpose reporting tool.
    And I want to know how to separate authorizations of SAP Query and Adhoc Query as below.
    As for SAP Query, users can only execute and cannnot change or delete it.
    As for Adhoc Query, users can save Queries they created or changed in Adhoc Query.
    I know there is only one authorization object for SAP Query:S_QUERY
    Is there any solution for that kind of request?
    Thanks and Regards,
    Hanae

    Hello,
    We have check in the abap program ask you functional to give the authorization object i.e. y_k_autchk
    and ask him for which filed we have to give authorizaion.
        AUTHORITY-CHECK OBJECT y_k_autchk
        ID 'WERKS' FIELD y_wa_tvarv-low.

  • Authority Check - Best Practice - Optimum Way

    Hi Experts,
    I want to use authority check in my reports. The requirement is to filter data on the selection screen and execute the query. Error messages are not to be thrown because, a user will find it difficult to enter all the document types/company codes/sales areas etc authorized and remove the ones not authorized from the range.
    I am planning to create range tables and populate it with the authorized values and use it in the select queries.
    I have two concerns:
    1. I will have to build range tables based on the values authorized. This will take some time, keeping in mind that append is an expensive statement.
    2. What if the range table becomes big enough to give me a dump in the select query in some scenario. (What if scenario? Its a rare possibility that some field like this also needs to be authorized)
    What is the best practice or rule of the thumb that you have figured out.
    Thanks,
    Abdullah Ismail.

    Are they asking you to check the authorisations for each of the following?
    1.     Sales Organization
    2. Distribution Channel
    3. Division
    4. Sales Group
    5. Sales Office
    6. Sales Document Type
    7. Sales Country
    8. Material Group(Brands)
    If so that is completely over engineered and good luck with that.  Surely you only need to check at one level of the sales structure, the lowest level I would guess.  Your auths team should be able to guide you here and I cannot imagine they would want that level of auths as it would be a nightmare for them to build it. I suppose you might want one on material group as well.
    Therefore they auths team or functional consultants will need to tell you at what level you are checking for each report, there will only be a small number at each level, (think you will struggle to get near the 12,000 Rob points out would cause an issue with a range) of the sales structure so I would use a range, you wonu2019t have that many appends and it wonu2019t add much to the time of the report.  While for all entries is great you can also use the range where the report may have already used for all entries on a select and better not to have to rebuild the whole report.
    Also I would do the auths check first up and make the field mandatory if they really want it nice and tight so the user has to choose, you can use a PID to make it a bit more friendly.
    If you know the setup is the same each time you could use a standard include and subroutine, or ABAP objects would probably be the best route with a set of standard methods to call.
    Hope that helps,
    Tim

  • How to add the fields to the transaction 'Z10SD25' using ABAP Query

    Hello,
    I want to add the new fields like 'From' and 'To' depending on some conditiions. But i have to do this using ABAP Query.
    Can any one help me with this as I am not much aware of ABAP Query .
    Regards,
    Darshana

    Hi,
    ABAP/4 query can be designed in four steps
    1.     Creation of a user group
    2.     Creation of Infoset
    3.     Assignment of user group to Infoset
    4.     Creation of the query based on Infoset
    By executing the transaction codes mentioned below
    u2022     SQ01   ABAP/4 Query
    u2022     SQ02   Infosets
    u2022     SQ03   User group
    Step 1: To create an Infoset without a logical database
    One of the following can be selected
    u2022     Based on a single table
    u2022     Using an ABAP/4 program
    u2022     Using Table Joins
    u2022     Using Sequential Dataset
    NOTE: The tables to be used in the join should have at least one field in common i.e. it should have the same name, domain or data element.
    Step 2: Here you specify the users who should be authorized to run the query. A user group is always associated with a Infoset.
    Step 3: In Query Definition you can define the Selections Screen. Here you can check against the fields(fields from the tables specified in the infoset above) that you require to be shown on the selection screen.
    Now we Finally need to specify the output type for the query as Basic List, Statistics or Ranked List. Choose the option Basic List and also select the fields to be displayed in the output list(in your case from and to fields...)
    After providing all the above options you can save the query and execute it by clicking the Execute button twice.
    Hope this helps
    Regards
    Shiva
    Edited by: Shiva Kumar Tirumalasetty on Sep 15, 2009 12:44 PM

  • Pnp- logical db in abap query

    hi.
    i need to create an ABAP/sap query. when i created the InfoSet i used logical db-pnp.
    if i want to get only the employees which entered my organization during the last month where should i add the ABAP code,  under which section => extras -> code. i have there several options - data, initialization, at selection-screen output etc, what to choose??????????
    thanks,
    Ami

    Hi
    Welcome to SDN forum
    query has got some limitatins compared to Reports which we write using SE38
    these queries are user specific and client specific and can't be transportable and you can't write your own code as you wish like reports
    see the doc
    http://help.sap.com/saphelp_46c/helpdata/en/35/26b413afab52b9e10000009b38f974/content.htm
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
    Step-by-step guide for creating ABAP query
    http://www.sappoint.com/abap/ab4query.pdf
    ABAP query is mostly used by functional consultants.
    SAP Query
    Purpose
    The SAP Query application is used to create lists not already contained in the SAP standard system. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists.
    Features
    SAP Query's range of functions corresponds to the classical reporting functions available in the system. Requirements in this area such as list, statistic, or ranked list creation can be met using queries.
    All the data required by users for their lists can be selected from any SAP table created by the customer.
    To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in WYSIWYG mode whenever you want using drag and drop and the other toolbox functions available.
    ABAP Query, as far as I Believe, is the use of select statements in the ABAP Programming. This needs a knowledge of Open SQL commands like Select,UPdtae, Modify etc. This has to be done only by someone who has a little bit of ABAP experience.
    To sum up, SAP queries are readymade programs given by SAP, which the user can use making slight modification like the slection texts, the tables from which the data is to be retrieved and the format in which the data is to be displayed.ABAP queries become imperative when there is no such SAP query existing and also when there is a lot of customizing involved to use a SAP Query directly
    use either SQ02 ans SQ01
    or SQVI tr code
    for more information please go thru this url:
    http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
    http://goldenink.com/abap/sap_query.html
    Please check this PDF document (starting page 352) perhaps it will help u.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    check the below link will be helpful for u
    Tutorial on SQVI
    once you create query system generates a report starting with AQZZ/SAPQUERY/ABAGENCY2======= assing this report to tr code for the same
    Regards
    Anji

  • How to hide some fields in ABAP Query

    Hi,
    My ABAP Query has a long list of extracted fields. I wanted to set some of these output to "HIDE".
    This allow User the flexibility to decide what fields to show.
    How can I set the field to "HIDE" in my query?
    Thanks
    bye

    Hi Tim,
    You can do this by setting the Report layout variant in following steps:
    1. First define the parameter on selection screent for report variant.
    2. Data decelaration for variant.
    3. Value request to get already present variants on report:
    4. If doesn't choose the layout take out the default report layout.
    5. Initialize the report variant.
    6. Apply the variant to the REUSE_ALV_GRID_DISPLAY funtion module.
             Here to generate report variant first to open report output and then as per according to user set the layout of report using the layout icon of ALV with summation on value fields (as required) and create layout name.
    *Data Deceleration as below:
    Data :g_save(1) TYPE c,
    **      g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant TYPE disvariant,
    g_variant TYPE disvariant.
    *First Define the parameter to give layout of Report variant.
    SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE text-003.
    PARAMETERS: p_vari TYPE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK 3.
    * Process on value request
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    * Selection-Screen Checking
    AT SELECTION-SCREEN.
    PERFORM pai_of_selection_screen.
    INITIALIZATION.
    w_repid = sy-repid.
    PERFORM variant_init.
    * Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    FORM f4_for_variant .
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save     = g_save
    IMPORTING
    e_exit     = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    **  ELSE.
    **    IF g_exit = space.
    **    ENDIF.
    ENDIF.
    ENDFORM.                    " f4_for_variant
    FORM pai_of_selection_screen .
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM.                    " pai_of_selection_screen
    FORM variant_init .
    CLEAR g_variant.
    g_variant-report = w_repid.
    ENDFORM.                    " variant_init
    **While Showing report pass the variant :::
    g_save = 'A'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = w_repid
    i_structure_name   = 'IT_MAIN'
    is_layout          = i_layout
    is_print           = i_print
    it_fieldcat        = i_fieldcat[]
    it_events          = i_events[]
    i_save             = g_save
    is_variant         = g_variant
    TABLES
    t_outtab           = it_main
    EXCEPTIONS
    program_error      = 1
    OTHERS             = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Many Thanks / Himanshu Gupta

Maybe you are looking for

  • Battery indicator on N95 v21.0.016

    Hello all: Ever since I updated to the new v21.0.016 firmware, the battery indicator on my N95 acts kind of strange. For two days it shows a full charge (seven bars) and suddenly, in less than a couple of hour, goes down from seven bars to one bar (n

  • Custom Connector for Database for reconicitation

    Hi, I have written my own customer connector to load all the users from external application database to OIM for reconcilitation (just initial loading of users).Now I want to check if a user information is changed in OIM it should be reflected in dat

  • AlignmentAction in JEdtorPane/HTML Document

    Hi, I'm still developping my html editor.Here's my problem : when i apply an AlignmentAction (StyledEditorKit.AlignmentAction ("Align Left", StyleConstants.ALIGN_LEFT) in the JEditorPane, it is displayed correctly but not saved in the HTML format . S

  • I suggest buying the BB passport if you...

    ..do not play games much. but it would be good for emulator like SNES or others with keypad. look at the keypad    button location on BB passport, it is perfect for the game pad i think. ..want a long battery time. its really long. but there is a pho

  • Mba-2012 freezes, ways to diagnost

    Hello all! Here is my situation: - 13 inch mba 2012, i7 2.0, 8GB, 256GB - lastest OS X with the lastest update available on this moment - freezes from time to time. From time to time means 3-4 per month, or 1 per 2 month, randomly but not very often.