<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167634#M1978666</link>
    <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;raymond.giuseppi&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Thanks for the pointers, Raymond! TCodes SU24 and SU56 seem to be worth adding to my list of favorites!&lt;/P&gt;&lt;P&gt;Thing is, that in the meantime, the program was changed to query for ACTIVITY = '01' instead of '03' and it now throws the expected error when the user tries to execute it in the test system. We therefore can no longer test it under the same conditions as yesterday. The transaction is just a simple Z-Tcode without any special authorizations as we query the relevant ones within our programs (which in this particular case is for displaying material + plant data via M_MATE_WRK). SU24 therefore doesn't show anything for the TCode.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Bärbel&lt;/P&gt;</description>
    <pubDate>Fri, 06 Mar 2020 07:22:09 GMT</pubDate>
    <dc:creator>BaerbelWinkler</dc:creator>
    <dc:date>2020-03-06T07:22:09Z</dc:date>
    <item>
      <title>Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167630#M1978662</link>
      <description>&lt;P&gt;We sometimes use an AUTHORITY-CHECK against S_DEVELOP with ACTIVITY '03' (or '02') to control if fields on a selection-screen should be open for input or not:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;* Only developers can change max number of items to select
  AUTHORITY-CHECK OBJECT 'S_DEVELOP'
           ID 'DEVCLASS' DUMMY
           ID 'OBJTYPE'  DUMMY
           ID 'OBJNAME'  DUMMY
           ID 'P_GROUP'  DUMMY
           ID 'ACTVT' FIELD '03'.

  IF sy-subrc NE 0.
    LOOP AT SCREEN INTO DATA(ls_screen).
      IF ls_screen-group1 EQ 'DEV'.
        ls_screen-input = '0'.
        MODIFY SCREEN FROM ls_screen.
      ENDIF.
    ENDLOOP.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Now we happened upon a case during testing, where a user who is not a developer passes this check with SY-SUBRC = 0 and we don't understand why that is the case as we don't see a developer-related role in his profile. If we check the user via SE37 and function module AUTHORITY_CHECK and the corresponding values for ID and FIELD we get the expected error USER_NOT_AUTHORIZED back:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1787777-fm-authority-check.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;Shouldn't the actual authority check in the program and the function module produce the same result? I find it a bit "disconcerting" that they don't, to tell the truth! Or are we missing something? And yes, I noticed that the FM is "not released".&lt;/P&gt;
  &lt;P&gt;I tried finding something about this but it's kind of difficult with the many hits found when searching for "Authority-check"!&lt;/P&gt;
  &lt;P&gt;We are on NW750 EHP8&lt;/P&gt;
  &lt;P&gt;Thanks much and Cheers&lt;/P&gt;
  &lt;P&gt;Bärbel&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 14:52:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167630#M1978662</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2020-03-05T14:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167631#M1978663</link>
      <description>&lt;P&gt;I am happy to not having your problem! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Did you try to put a ST01 trace, and check you are loocking the right code ? &lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 15:08:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167631#M1978663</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2020-03-05T15:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167632#M1978664</link>
      <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;frdric.girod&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;LOL, Fred!&lt;/P&gt;&lt;P&gt;Haven't tried ST01 trace yet as - IIRC - we don't have authorization to run the auth-trace. We however looked at it via debugging, so I'd hazard the guess, that we are in the correct program. I think that the authority-check in the ABAP-code actually triggers a kernel function and that the FM is therefore a completely different entity. I'm just suprised that they don't give the same result regardless.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 15:14:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167632#M1978664</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2020-03-05T15:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167633#M1978665</link>
      <description>&lt;P&gt;Which transaction was executed by the user, some transactions (and other objects) can be defined to override authority-check, call SU24 for the transaction, and look at column 'Check Indicator', is some authorization object tagged as 'Do not check'? (NB: The profile parameter AUTH/NO_CHECK_IN_SOME_CASES activate this behavior, check with RZ10 or ask basis)&lt;/P&gt;&lt;P&gt;If ST01 is not allowed, did you also check with SU53 (or SU56 for buffer analyzsi)  for an unexpected successful check?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 16:05:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167633#M1978665</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2020-03-05T16:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167634#M1978666</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;raymond.giuseppi&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Thanks for the pointers, Raymond! TCodes SU24 and SU56 seem to be worth adding to my list of favorites!&lt;/P&gt;&lt;P&gt;Thing is, that in the meantime, the program was changed to query for ACTIVITY = '01' instead of '03' and it now throws the expected error when the user tries to execute it in the test system. We therefore can no longer test it under the same conditions as yesterday. The transaction is just a simple Z-Tcode without any special authorizations as we query the relevant ones within our programs (which in this particular case is for displaying material + plant data via M_MATE_WRK). SU24 therefore doesn't show anything for the TCode.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Bärbel&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 07:22:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167634#M1978666</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2020-03-06T07:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167635#M1978667</link>
      <description>&lt;P&gt;Does your authority check is in an event of the program ?  maybe the user find a way to not go in this event before executing the program ... &lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 07:24:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167635#M1978667</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2020-03-06T07:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167636#M1978668</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;frdric.girod&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;It's done in AT SELECTION-SCREEN OUTPUT and other logic in that event is processed so the auth-check should be as well. But, as mentioned below in my response to Raymond, we can no longer test as the code was changed in the meantime.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 07:38:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167636#M1978668</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2020-03-06T07:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167637#M1978669</link>
      <description>&lt;P&gt;Developers rarely enter SU24 for specific transactions. This is a pity because the information entered there in addition to a document role is used by PFCG when creating the roles. &lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 11:15:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167637#M1978669</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2020-03-06T11:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167638#M1978670</link>
      <description>&lt;P&gt;TL;DR&lt;/P&gt;&lt;P&gt;DUMMY of AUTHORITY-CHECK (ABAP statement) = no mention of authorization field in AUTHORITY_CHECK (function module).&lt;/P&gt;&lt;P&gt;LONG version&lt;/P&gt;&lt;P&gt;In 7.52, if parameter USER is not passed (or set to SY-UNAME), the code of function module AUTHORITY_CHECK is strictly equal to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  authority-check object object
          id field1  field value1
          id field2  field value2
          id field3  field value3
          id field4  field value4
          id field5  field value5
          id field6  field value6
          id field7  field value7
          id field8  field value8
          id field9  field value9
          id field10 field value10.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So, you can assume that there can't be any difference with AUTHORITY-CHECK.&lt;/P&gt;&lt;P&gt;The main difference in your code is around &lt;STRONG&gt;DUMMY&lt;/STRONG&gt;. If you call AUTHORITY_CHECK with parameters set to 'DUMMY', it's equivalent to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AUTHORITY-CHECK OBJECT 'S_DEVELOP'
           ID 'DEVCLASS' FIELD 'DUMMY'
           ID 'OBJTYPE'  FIELD 'DUMMY'
           ID 'OBJNAME'  FIELD 'DUMMY'
           ID 'P_GROUP'  FIELD 'DUMMY'
           ID 'ACTVT'    FIELD '03'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which means that there must be at least one authorization with field DEVCLASS matching 'DUMMY' and field OBJTYPE matching 'DUMMY', etc.&lt;/P&gt;&lt;P&gt;That's not equivalent at all to your requirement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  AUTHORITY-CHECK OBJECT 'S_DEVELOP'
           ID 'DEVCLASS' DUMMY
           ID 'OBJTYPE'  DUMMY
           ID 'OBJNAME'  DUMMY
           ID 'P_GROUP'  DUMMY
           ID 'ACTVT'    FIELD '03'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which is strictly equivalent to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  AUTHORITY-CHECK OBJECT 'S_DEVELOP'
           ID 'ACTVT' FIELD '03'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or even, less intuitively (and less officially as it's not in the ABAP documentation but it can be deduced from the SAP note &lt;A href="https://launchpad.support.sap.com/#/notes/1022413/E"&gt;1022413 - Make AUTHORITY-CHECK and AUTHORITY_CHECK consistent&lt;/A&gt;, "The same result can be achieved when calling function module AUTHORITY_CHECK", and from AUTHORITY_CHECK code), to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  AUTHORITY-CHECK OBJECT 'S_DEVELOP'
           ID ''      FIELD ''
           ID ''      FIELD ''
           ID ''      FIELD ''
           ID ''      FIELD ''
           ID 'ACTVT' FIELD '03'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And so, your requirement is strictly equivalent to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'AUTHORITY_CHECK'
  EXPORTING
    object   = 'S_DEVELOP'
    field1   = 'ACTVT'
    value1   = '03'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'AUTHORITY_CHECK'
  EXPORTING
    object   = 'S_DEVELOP'
    field5   = 'ACTVT'
    value5   = '03'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or even:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'AUTHORITY_CHECK'
  EXPORTING
    object   = 'S_DEVELOP'
    field1   = ''
    value1   = ''
    field2   = ''
    value2   = ''
    field3   = ''
    value3   = ''
    field4   = ''
    value4   = ''
    field5   = 'ACTVT'
    value5   = '03'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;NB: the next one is wrong because it looks for an authorization with fields containing a real space value (' '):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  AUTHORITY-CHECK OBJECT 'S_DEVELOP'
           ID 'DEVCLASS' FIELD ''
           ID 'OBJTYPE'  FIELD ''
           ID 'OBJNAME'  FIELD ''
           ID 'P_GROUP'  FIELD ''
           ID 'ACTVT'    FIELD '03'.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 14:23:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167638#M1978670</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-03-06T14:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why does AUTHORITY-CHECK give different result than function module AUTHORITY_CHECK?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167639#M1978671</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Thanks for your detailed explanation, Sandra! I'm sure it'll help not just me but also others puzzled by the subtle difference!&lt;/P&gt;&lt;P&gt;So, when the check for the user came back with "no authorization" in the function module version of the check the reason was that it failed for him not having authorization for the fields checked against "DUMMY" and not because of the activity as we thought (or wrongly jumped to the conclusion!).&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Bärbel&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 15:05:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-authority-check-give-different-result-than-function-module/m-p/12167639#M1978671</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2020-03-06T15:05:22Z</dc:date>
    </item>
  </channel>
</rss>

