SAP SO_CHECK_USER_ROLE Function Module for
SO_CHECK_USER_ROLE is a standard so check user role SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for so check user role FM, simply by entering the name SO_CHECK_USER_ROLE into the relevant SAP transaction such as SE37 or SE38.
Function Group: SOA3
Program Name: SAPLSOA3
Main Program: SAPLSOA3
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function SO_CHECK_USER_ROLE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'SO_CHECK_USER_ROLE'".
EXPORTING
* LOCAL_PROFILE = ' ' "
* OWNER = ' ' "Owner of an object ( not necessarily sy-uname)
IMPORTING
ACTIVE_DATA = "Data of sy-uname
ACTIVE_ID = "Office-ID of sy-unamen
ACTIVE_RIGHTS = "Authorizations of sy-uname
OWNER = "Owner of an object ( not necessarily sy-uname)
OWNER_DATA = "Office data of owner
OWNER_ID = "Office ID of owner
ROLE = "Role in Office of sy-uname
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1 COMMUNICATION_FAILURE = 2 COMPONENT_NOT_AVAILABLE = 3 OWNER_NOT_EXIST = 4 PARAMETER_ERROR = 5 SUBSTITUTE_NOT_ACTIVE = 6 SUBSTITUTE_NOT_DEFINED = 7 SYSTEM_FAILURE = 8 X_ERROR = 9
IMPORTING Parameters details for SO_CHECK_USER_ROLE
LOCAL_PROFILE -
Data type: SOPRDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
OWNER - Owner of an object ( not necessarily sy-uname)
Data type: SOUD-USRNAMDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SO_CHECK_USER_ROLE
ACTIVE_DATA - Data of sy-uname
Data type: SOUDDOptional: No
Call by Reference: No ( called with pass by value option)
ACTIVE_ID - Office-ID of sy-unamen
Data type: SOUDKOptional: No
Call by Reference: No ( called with pass by value option)
ACTIVE_RIGHTS - Authorizations of sy-uname
Data type: SOSUDOptional: No
Call by Reference: No ( called with pass by value option)
OWNER - Owner of an object ( not necessarily sy-uname)
Data type: SOUD-USRNAMOptional: No
Call by Reference: No ( called with pass by value option)
OWNER_DATA - Office data of owner
Data type: SOUDDOptional: No
Call by Reference: No ( called with pass by value option)
OWNER_ID - Office ID of owner
Data type: SOUDKOptional: No
Call by Reference: No ( called with pass by value option)
ROLE - Role in Office of sy-uname
Data type: SONV-USRROLEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ACTIVE_USER_NOT_EXIST - Sy-uname does not have Office name
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
COMMUNICATION_FAILURE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
COMPONENT_NOT_AVAILABLE - Component is not installed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OWNER_NOT_EXIST - Owner does not exist in SAPoffice
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
PARAMETER_ERROR - Parameters not transferred correct
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SUBSTITUTE_NOT_ACTIVE - Substitute was not activated
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SUBSTITUTE_NOT_DEFINED - Substitute was not defined
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SYSTEM_FAILURE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
X_ERROR - Internal error (DB error)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SO_CHECK_USER_ROLE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_active_data | TYPE SOUDD, " | |||
| lv_local_profile | TYPE SOPRD, " SPACE | |||
| lv_active_user_not_exist | TYPE SOPRD, " | |||
| lv_owner | TYPE SOUD-USRNAM, " SPACE | |||
| lv_active_id | TYPE SOUDK, " | |||
| lv_communication_failure | TYPE SOUDK, " | |||
| lv_active_rights | TYPE SOSUD, " | |||
| lv_component_not_available | TYPE SOSUD, " | |||
| lv_owner | TYPE SOUD-USRNAM, " | |||
| lv_owner_not_exist | TYPE SOUD, " | |||
| lv_owner_data | TYPE SOUDD, " | |||
| lv_parameter_error | TYPE SOUDD, " | |||
| lv_owner_id | TYPE SOUDK, " | |||
| lv_substitute_not_active | TYPE SOUDK, " | |||
| lv_role | TYPE SONV-USRROLE, " | |||
| lv_substitute_not_defined | TYPE SONV, " | |||
| lv_system_failure | TYPE SONV, " | |||
| lv_x_error | TYPE SONV. " |
|   CALL FUNCTION 'SO_CHECK_USER_ROLE' " |
| EXPORTING | ||
| LOCAL_PROFILE | = lv_local_profile | |
| OWNER | = lv_owner | |
| IMPORTING | ||
| ACTIVE_DATA | = lv_active_data | |
| ACTIVE_ID | = lv_active_id | |
| ACTIVE_RIGHTS | = lv_active_rights | |
| OWNER | = lv_owner | |
| OWNER_DATA | = lv_owner_data | |
| OWNER_ID | = lv_owner_id | |
| ROLE | = lv_role | |
| EXCEPTIONS | ||
| ACTIVE_USER_NOT_EXIST = 1 | ||
| COMMUNICATION_FAILURE = 2 | ||
| COMPONENT_NOT_AVAILABLE = 3 | ||
| OWNER_NOT_EXIST = 4 | ||
| PARAMETER_ERROR = 5 | ||
| SUBSTITUTE_NOT_ACTIVE = 6 | ||
| SUBSTITUTE_NOT_DEFINED = 7 | ||
| SYSTEM_FAILURE = 8 | ||
| X_ERROR = 9 | ||
| . " SO_CHECK_USER_ROLE | ||
ABAP code using 7.40 inline data declarations to call FM SO_CHECK_USER_ROLE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| DATA(ld_local_profile) | = ' '. | |||
| "SELECT single USRNAM FROM SOUD INTO @DATA(ld_owner). | ||||
| DATA(ld_owner) | = ' '. | |||
| "SELECT single USRNAM FROM SOUD INTO @DATA(ld_owner). | ||||
| "SELECT single USRROLE FROM SONV INTO @DATA(ld_role). | ||||
Search for further information about these or an SAP related objects