<?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: regarding authorization in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-authorization/m-p/3472520#M834681</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are checking whether the user has the authorization for the CLASS ( User group in user master maintenance) which he is using. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the CLASS parameter you got from direct input from selection screen from your program or from a database select in your code. Now two senerio possible : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. CLASS have a single value in your program&lt;/P&gt;&lt;P&gt;2. CLASS have a list values in your program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;1. When CLASS have a single value&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose the value is P_CLASS. Now you check the authorization of user by the following code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK OBJECT 'S_USER_GRP'&lt;/P&gt;&lt;P&gt;ID 'ClASS' FIELD P_CLASS&lt;/P&gt;&lt;P&gt;ID 'ACTVT' FIELD '01'.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC EQ 0 means user has the authorization. In that case carryout the normal prossaing. If authorization fails (sy-subrc NE 0). Then you need to carryout operation according your logic. That may be stoping your program execution and display a error message. But it can varry according to your senerio.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;CLASS have a list values&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose values are in LT_CLASS table. Then you need to loop LT_CLASS and check the authorization of each CLASS and if authorization fails you have to delete it from LT_CLASS table. Rest of your program will only consider the CLASS for which user has authorization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT LT_CLASS INTO LW_CLASS.
     AUTHORITY-CHECK OBJECT 'S_USER_GRP'
              ID 'ClASS' FIELD LW_CLASS-CLASS
              ID 'ACTVT' FIELD '01'.
              IF SY-SUBRC NE 0.
                  DELETE LT_CLASS.
             ENDIF.
     CLEAR: LW_CLASS.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Mar 2008 05:34:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-05T05:34:13Z</dc:date>
    <item>
      <title>regarding authorization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-authorization/m-p/3472518#M834679</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;plz tell me how i can use this code in my report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK OBJECT 'S_USER_GRP'&lt;/P&gt;&lt;P&gt;        ID 'ClASS' FIELD 'AUDIT'&lt;/P&gt;&lt;P&gt;        ID 'ACTVT' FIELD '01'.&lt;/P&gt;&lt;P&gt;   IF SY-SUBRC NE 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  041 Keine Berechtigung zum Anlegen von Benutzergruppe &amp;amp;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      MESSAGE E041(01) WITH '  '.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have written this code in my report but it's not working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 05:20:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-authorization/m-p/3472518#M834679</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T05:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: regarding authorization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-authorization/m-p/3472519#M834680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Authority check is just for checking that if any user wants to access the report then does he has that authority, if yes then report will be displayed otherwise the Error message will be displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more information Write &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK and press F1 on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&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;Dhruv Shah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 05:28:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-authorization/m-p/3472519#M834680</guid>
      <dc:creator>dhruv_shah3</dc:creator>
      <dc:date>2008-03-05T05:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: regarding authorization</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-authorization/m-p/3472520#M834681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are checking whether the user has the authorization for the CLASS ( User group in user master maintenance) which he is using. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the CLASS parameter you got from direct input from selection screen from your program or from a database select in your code. Now two senerio possible : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. CLASS have a single value in your program&lt;/P&gt;&lt;P&gt;2. CLASS have a list values in your program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;1. When CLASS have a single value&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose the value is P_CLASS. Now you check the authorization of user by the following code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK OBJECT 'S_USER_GRP'&lt;/P&gt;&lt;P&gt;ID 'ClASS' FIELD P_CLASS&lt;/P&gt;&lt;P&gt;ID 'ACTVT' FIELD '01'.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC EQ 0 means user has the authorization. In that case carryout the normal prossaing. If authorization fails (sy-subrc NE 0). Then you need to carryout operation according your logic. That may be stoping your program execution and display a error message. But it can varry according to your senerio.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;CLASS have a list values&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose values are in LT_CLASS table. Then you need to loop LT_CLASS and check the authorization of each CLASS and if authorization fails you have to delete it from LT_CLASS table. Rest of your program will only consider the CLASS for which user has authorization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT LT_CLASS INTO LW_CLASS.
     AUTHORITY-CHECK OBJECT 'S_USER_GRP'
              ID 'ClASS' FIELD LW_CLASS-CLASS
              ID 'ACTVT' FIELD '01'.
              IF SY-SUBRC NE 0.
                  DELETE LT_CLASS.
             ENDIF.
     CLEAR: LW_CLASS.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2008 05:34:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-authorization/m-p/3472520#M834681</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-05T05:34:13Z</dc:date>
    </item>
  </channel>
</rss>

