<?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: Authorization restriction for executing the ABAP queries in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007653#M1496193</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;  You are right, if you proceed as sample below you will check authorization for specific user:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AUTHORITY-CHECK OBJECT 'C_PRPS_PRC'
ID 'PRCTR' FIELD PROJ-PRCTR
ID 'PS_ACTVT' FIELD '02'.

IF sy-subrc NE 0.
  EXIT
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jun 2010 22:04:29 GMT</pubDate>
    <dc:creator>former_member214857</dc:creator>
    <dc:date>2010-06-17T22:04:29Z</dc:date>
    <item>
      <title>Authorization restriction for executing the ABAP queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007652#M1496192</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;In ABAP queiries how the restriction can be done for where users should not execute /authorized &lt;/P&gt;&lt;P&gt;of other plant or company code - Projects/ WBS/NWA and its related components. I tried the following methods but not working - seems something is missing .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method 1) restricting based on the profit center ( free coding )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK OBJECT 'C_PRPS_PRC'&lt;/P&gt;&lt;P&gt;         ID 'PRCTR' FIELD PROJ-PRCTR&lt;/P&gt;&lt;P&gt;         ID 'PS_ACTVT' FIELD '02'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(or) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method 2 -(free coding) &lt;/P&gt;&lt;P&gt;*---Authorization for Company code entered by the users.&lt;/P&gt;&lt;P&gt;*---This code will restrict users to see data for company&lt;/P&gt;&lt;P&gt;*---codes which they are not authorized to.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*---Select all the company codes based upon selection entered by the&lt;/P&gt;&lt;P&gt;*---user&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; SELECT bukrs&lt;/P&gt;&lt;P&gt;   FROM t001&lt;/P&gt;&lt;P&gt;   INTO TABLE li_bukrs&lt;/P&gt;&lt;P&gt;  WHERE bukrs IN z_bukrs.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*---Clear Screen variable for Company code&lt;/P&gt;&lt;P&gt;   CLEAR z_bukrs.&lt;/P&gt;&lt;P&gt;   REFRESH z_bukrs.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*---Filter and prepare Select options for Company code table to be&lt;/P&gt;&lt;P&gt;*---passed to query. Table will only have values of company codes he is&lt;/P&gt;&lt;P&gt;*---authorized to for display.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   LOOP AT li_bukrs INTO lwa_bukrs.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;     AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'&lt;/P&gt;&lt;P&gt;                       ID 'BUKRS' FIELD lwa_bukrs&lt;/P&gt;&lt;P&gt;                       ID 'ACTVT' FIELD '03'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;     IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;       z_bukrs-sign = 'I'.&lt;/P&gt;&lt;P&gt;       z_bukrs-option = 'EQ'.&lt;/P&gt;&lt;P&gt;       z_bukrs-low = lwa_bukrs.&lt;/P&gt;&lt;P&gt;       z_bukrs-high = space.&lt;/P&gt;&lt;P&gt;       APPEND z_bukrs.&lt;/P&gt;&lt;P&gt;     ELSE.&lt;/P&gt;&lt;P&gt;       lv_flag = 'X'.&lt;/P&gt;&lt;P&gt;     ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   ENDLOOP.&lt;/P&gt;&lt;P&gt;*---Give warning message to the user in case he is not authorized to see&lt;/P&gt;&lt;P&gt;*---data for all the company codes that he has entered.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   IF lv_flag = 'X'.&lt;/P&gt;&lt;P&gt;     MESSAGE ID 'ZF_MSS_FNG' TYPE 'W' NUMBER '015'.&lt;/P&gt;&lt;P&gt;   ENDIF.&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;Just make sure that Z_BUKRS field is available in selection tab.&lt;/P&gt;&lt;P&gt;Also, declare below mentioned variables in INITIALIZATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: li_bukrs TYPE TABLE OF bukrs,&lt;/P&gt;&lt;P&gt;       lwa_bukrs TYPE bukrs,&lt;/P&gt;&lt;P&gt;       lv_flag TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly help if there is missing anything on the above or is there any other alternative.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;PP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jun 2010 08:02:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007652#M1496192</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-09T08:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Authorization restriction for executing the ABAP queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007653#M1496193</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;  You are right, if you proceed as sample below you will check authorization for specific user:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AUTHORITY-CHECK OBJECT 'C_PRPS_PRC'
ID 'PRCTR' FIELD PROJ-PRCTR
ID 'PS_ACTVT' FIELD '02'.

IF sy-subrc NE 0.
  EXIT
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 22:04:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007653#M1496193</guid>
      <dc:creator>former_member214857</dc:creator>
      <dc:date>2010-06-17T22:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Authorization restriction for executing the ABAP queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007654#M1496194</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;PRE&gt;&lt;CODE&gt;Kindly help if there is missing anything on the above or is there any other alternative.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Carlos is right about the Authorization check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you further wants to explore something extra, just visit these links:&lt;/P&gt;&lt;P&gt;1. &lt;A href="http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/52/671449439b11d1896f0000e8322d00/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/52/671449439b11d1896f0000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2. &lt;A href="http://help.sap.com/saphelp_wp/helpdata/en/52/67129f439b11d1896f0000e8322d00/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_wp/helpdata/en/52/67129f439b11d1896f0000e8322d00/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;3. &lt;A href="http://help.sap.com/crmcg_en/5c/deaa74d3d411d3970a0000e82de14a/content.htm" target="test_blank"&gt;http://help.sap.com/crmcg_en/5c/deaa74d3d411d3970a0000e82de14a/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;4. &lt;A href="http://www.sap-img.com/bc042.htm" target="test_blank"&gt;http://www.sap-img.com/bc042.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May this information helps you.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Deepak Sharma.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 03:58:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007654#M1496194</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-18T03:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Authorization restriction for executing the ABAP queries</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007655#M1496195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carlos&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added the logic as u mentioned and set the breakpoint to test the query but the query is not stopping and resulting for all.&lt;/P&gt;&lt;P&gt;Not sure what is missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly help to prove this authorization check working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;PP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jun 2010 08:49:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/authorization-restriction-for-executing-the-abap-queries/m-p/7007655#M1496195</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-29T08:49:11Z</dc:date>
    </item>
  </channel>
</rss>

