Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sapscript Authorization

Former Member
0 Likes
763

Hi,

How can i check if a user has authorization in sapscript?. Sample code will help.

Thanks,

Sandeep

4 REPLIES 4
Read only

suresh_datti
Active Contributor
0 Likes
590

In SAPSCRIPT, the checks are valid only for st texts..PL check this <a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/d6/0db682494511d182b70000e829fbfe/frameset.htm">SAP Help</a> for more info..

~Suresh

Read only

Former Member
0 Likes
590

Hi,

You can use the perform statement to check for authorization.

http://help.sap.com/saphelp_46c/helpdata/EN/d1/803048454211d189710000e8322d00/frameset.htm

Hope this works..

Thanks,

Naren

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
590

If you want to programmaticlly check whether another user is authorized for editing sapscript forms, then you can use the following code.



report zrich_0001.

parameters: p_uname type sy-uname.

data: subrc type sy-subrc.

call function 'SUSR_AUTHORITY_CHECK_SIMULATE'
  exporting
    user_name             = p_uname
    object                = 'S_SCRP_FRM'
    field1                = 'FORMNAME'
    val1                  = '*'
    field2                = 'LANGUAGE'
    val2                  = 'E'
    field3                = 'ACTVT'
    val3                  = '02'      "Edit Mode
 importing
    sy_subrc              = subrc
 exceptions
   not_authorized        = 1
   user_not_exists       = 2
   internal_error        = 3
   others                = 4.

if subrc <> 0.
  write:/ 'User is not authorized for editing sapscripts'.
else.
  write:/ 'User is authorized for editing sapscripts'.
endif.

Regards,

Rich Heilman

Read only

0 Likes
590

Rich,

I want to restrict on users how can run the sapscript.

Sandeep