<?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: Authority-Check in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921132#M58975</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fidel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in general its:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;01 = Create&lt;/P&gt;&lt;P&gt;02 = Change&lt;/P&gt;&lt;P&gt;03 = Display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is also followed in transaction does: eg VA01, VA02, VA03 for create,change, display sales orders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These rules are not fixed but are generally true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 May 2005 15:59:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-05-31T15:59:55Z</dc:date>
    <item>
      <title>Authority-Check</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921130#M58973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having a problem with the authority-check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assign a new role and authorization that I created for user DDIC in MINISAP, and in my program I put the fallowing chunk of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK OBJECT 'S_CARRID'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           ID  'P_CAR'  FIELD  'AA'&lt;/P&gt;&lt;P&gt;           ID  'ACTVT'  FIELD '02'.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MESSAGE e157(zfidemsg).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  User not authorized. Session terminated&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then, in the  role I specify, the user will have Display access to the object s_carrid (field carrid) to all the airline carriers, but when in my program I select LH (a carrier) is not allowing me to display the selection. and I only check for AA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone tell me which is my mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advanced,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fidel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2005 15:51:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921130#M58973</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-31T15:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Authority-Check</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921131#M58974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fidel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For display you should check with ACTVT equal to '03' not '02'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'02' is for change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2005 15:58:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921131#M58974</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-31T15:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Authority-Check</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921132#M58975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fidel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in general its:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;01 = Create&lt;/P&gt;&lt;P&gt;02 = Change&lt;/P&gt;&lt;P&gt;03 = Display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is also followed in transaction does: eg VA01, VA02, VA03 for create,change, display sales orders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These rules are not fixed but are generally true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2005 15:59:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921132#M58975</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-31T15:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Authority-Check</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921133#M58976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but my problem is that I want to control the particular user when he tried to display the data of AA (only AA).&lt;/P&gt;&lt;P&gt;so he can have access to the other carriers. That is the reason why I put 02 so he can't have access to AA but will have it for LH, AZ etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is that the right way to prevent a user to access AA and have access to the other carriers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fidel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2005 16:10:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921133#M58976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-31T16:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Authority-Check</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921134#M58977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fidel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would do it like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IF w_carid = 'AA'.
  AUTHORITY-CHECK OBJECT 'S_CARRID'
    ID 'P_CAR' FIELD w_carid
    ID 'ACTVT' FIELD '03'.
  IF SY-SUBRC NE 0.
    MESSAGE ...
  ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is the simplest solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Brad Williams (added return code check)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2005 16:28:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921134#M58977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-31T16:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Authority-Check</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921135#M58978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your current check is not correct as it will only and only allow the cases where carid is 'AA' and ACTVT is 02.&lt;/P&gt;&lt;P&gt; it will be false even if carrid is not 'AA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In real time programs this kind of coding is not generally required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you should do the coding as below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CASE SY-UCOMM.
  WHEN 'CREA'.
    lv_actvt = '01'.
  WHEN 'EDIT'.
    lv_actvt = '02'.
  WHEN 'DISP'.
    lv_actvt = '03'.
ENDCASE.
lv_current_carid will have the value of current carrid.

AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'P_CAR' FIELD lv_current_carid
ID 'ACTVT' FIELD lv_actvt .
IF sy-subrc &amp;lt;&amp;gt; 0 and .
   MESSAGE e157(zfidemsg).
*  User not authorized. Session terminated
   ENDIF.

ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will ensure that all those who have proper authorizations will be able to create/change / display accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it will also ensure that authorizations will be controlled from role assignemnt config and not by changing the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if you are adamant to do this from within your program then&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CASE lv_carid.
WHEN 'AA'.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'P_CAR' FIELD 'AA'
ID 'ACTVT' FIELD '02'.
IF sy-subrc ne 0.
   MESSAGE e157(zfidemsg).
*  User not authorized. Session terminated
ENDIF.

WHEN others.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'P_CAR' FIELD '*'   " or ID 'P_CAR' FIELD lv_carid
ID 'ACTVT' FIELD '03'.
IF sy-subrc ne 0.
   MESSAGE e157(zfidemsg).
*  User not authorized. Session terminated
ENDIF.
ENDCASE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Ram Manohar Tiwari&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Ram Manohar Tiwari&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2005 17:06:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921135#M58978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-31T17:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Authority-Check</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921136#M58979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Brad and Ram, you guys solved the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fidel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2005 18:22:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authority-check/m-p/921136#M58979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-31T18:22:12Z</dc:date>
    </item>
  </channel>
</rss>

