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

RFC method to check authorizations?

Former Member
0 Likes
4,150

Hi gurus,

anybody has experience of checking authorizations via RFC method? Is there any RFC enabled function module in standard system can do that?

Thanks & regards,

Alex

1 ACCEPTED SOLUTION
Read only

StMou
Active Participant
0 Likes
1,969

Hi,

Try this FM AUTHORITY_CHECK.

You can call in Remote and you can pass User ID.

You must pass also Authority check you would like test.

Example


CALL FUNCTION 'AUTHORITY_CHECK'
  EXPORTING
*   NEW_BUFFERING             = 3
   USER                      = 'SAP*'   "SY-UNAME
    OBJECT                    = S_TCODE " Objet name    This check transaction code
   FIELD1                    = 'TCODE'  " Field name of Object
   VALUE1                    = 'VA02'   " Transaction to modify sales Order
*   FIELD2                    = ' '
*   VALUE2                    = ' '
*   FIELD3                    = ' '
*   VALUE3                    = ' '
*   FIELD4                    = ' '
*   VALUE4                    = ' '
*   FIELD5                    = ' '
*   VALUE5                    = ' '
*   FIELD6                    = ' '
*   VALUE6                    = ' '
*   FIELD7                    = ' '
*   VALUE7                    = ' '
*   FIELD8                    = ' '
*   VALUE8                    = ' '
*   FIELD9                    = ' '
*   VALUE9                    = ' '
*   FIELD10                   = ' '
*   VALUE10                   = ' '
 EXCEPTIONS
   USER_DONT_EXIST           = 1
   USER_IS_AUTHORIZED        = 2
   USER_NOT_AUTHORIZED       = 3
   USER_IS_LOCKED            = 4
   OTHERS                    = 5
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Rgds

7 REPLIES 7
Read only

Former Member
0 Likes
1,969

Hi,

something more specific please; otherwise the answer is very general.

Probably you´ll have to create your own RFC-enabled function for reading the authorizations for object & user in the target system. Your return parameter could be a 'X' if sucessful or ' ' if no authorization.

Read only

0 Likes
1,969

Hi all,

thanks for your reply.

I need to check user authorizations in a java application connecting to R/3 via RFC. Currently the user profile name can be read via BAPI_USER_GET_DETAIL. I need to know whether the user has authorization to do something in Java application. If in ABAP, we have key word AUTHORITY-CHECK OBJECT to do the job. I need RFC method with similar functionalitiy, so I can call it from Java application.

I hope SAP has standard RFC doing that. If not, maybe I need create my own.

Thanks.

Read only

Former Member
0 Likes
1,969

Hi!

Let's see it through an example, like there are 2 SAP systems, A and B.

You made an RFC ready FM in system A.

You wanted to call this RFC ready FM, from system B.

For this you have to set up and RFC connection first in system B, using SM59 transaction. This RFC connection requires a SAP user in system B for logging into the system. In most common there are system type users in system B, and these system users have SAP_ALL authority to be able to run everything. Note: systems users cannot be used manually, only for running jobs, using RFC etc...

Regards

Tamá

Read only

Former Member
0 Likes
1,969

Hi,

Try this FM AUTHORITY_CHECK_RFC.

Thanks,

Suman

Read only

0 Likes
1,969

Hi Choudhary,

thanks. but that's not the one. it checks whether an user has permission to execute a RFC FM. I need a RFC FM checking user against any authorization objects.

Thanks .

Read only

StMou
Active Participant
0 Likes
1,970

Hi,

Try this FM AUTHORITY_CHECK.

You can call in Remote and you can pass User ID.

You must pass also Authority check you would like test.

Example


CALL FUNCTION 'AUTHORITY_CHECK'
  EXPORTING
*   NEW_BUFFERING             = 3
   USER                      = 'SAP*'   "SY-UNAME
    OBJECT                    = S_TCODE " Objet name    This check transaction code
   FIELD1                    = 'TCODE'  " Field name of Object
   VALUE1                    = 'VA02'   " Transaction to modify sales Order
*   FIELD2                    = ' '
*   VALUE2                    = ' '
*   FIELD3                    = ' '
*   VALUE3                    = ' '
*   FIELD4                    = ' '
*   VALUE4                    = ' '
*   FIELD5                    = ' '
*   VALUE5                    = ' '
*   FIELD6                    = ' '
*   VALUE6                    = ' '
*   FIELD7                    = ' '
*   VALUE7                    = ' '
*   FIELD8                    = ' '
*   VALUE8                    = ' '
*   FIELD9                    = ' '
*   VALUE9                    = ' '
*   FIELD10                   = ' '
*   VALUE10                   = ' '
 EXCEPTIONS
   USER_DONT_EXIST           = 1
   USER_IS_AUTHORIZED        = 2
   USER_NOT_AUTHORIZED       = 3
   USER_IS_LOCKED            = 4
   OTHERS                    = 5
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Rgds

Read only

Former Member
0 Likes
1,969

great! thank you very much!