SAP TWP_GET_ROLE_DATA Function Module for
TWP_GET_ROLE_DATA is a standard twp get role data 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 twp get role data FM, simply by entering the name TWP_GET_ROLE_DATA into the relevant SAP transaction such as SE37 or SE38.
Function Group: PWP2
Program Name: SAPLPWP2
Main Program: SAPLPWP2
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function TWP_GET_ROLE_DATA 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 'TWP_GET_ROLE_DATA'".
EXPORTING
ROLE_NAME = "
* NO_USERS_FROM_COMPOSITE_ROLES = 'X' "
* MIGRATE_SERVICES = 'X' "
* ONLY_FOLLOWING_LANGUAGE = "
* OPTIMIZED = "
IMPORTING
ROLE_IS_COMPOSITE = "
ROLE_HAS_USER_ASSIGNMENT = "
ROLE_IS_A_SAP_ROLE = "
ROLE_HAS_MENU = "
LOGSYS = "
TABLES
* AGR_DEFINE = "
* AGR_TCODES = "
* AGR_TIME = "
* AGR_CUSTOM = "
* AGR_LSD = "
* AGR_MAPP = "
* AGR_MINI = "
* AGR_MINIT = "
* SERVICE_TABLE = "
* SERVICE_TEXTS = "
* AGR_HIER = "
* AGR_HIERT = "
* AGR_AGRS = "
* AGR_TEXTS = "
* AGR_BUFFI = "
* AGR_ATTS = "
* AGR_FLAGS = "
* AGR_HPAGE = "
EXCEPTIONS
ROLES_NOT_SUPPORTED = 1 ROLE_NOT_FOUND = 2 PARAMETER_ROLE_NAME_EMPTY = 3 LOGICAL_SYSTEM_ERROR = 4
IMPORTING Parameters details for TWP_GET_ROLE_DATA
ROLE_NAME -
Data type: TWPAGRLIST-AGR_NAMEOptional: No
Call by Reference: No ( called with pass by value option)
NO_USERS_FROM_COMPOSITE_ROLES -
Data type: TWPTEMP-TWPFLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
MIGRATE_SERVICES -
Data type: TWPTEMP-TWPFLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
ONLY_FOLLOWING_LANGUAGE -
Data type: TWPAGRTEXT-SPRASOptional: Yes
Call by Reference: No ( called with pass by value option)
OPTIMIZED -
Data type: TWPTEMP-TWPFLAGOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for TWP_GET_ROLE_DATA
ROLE_IS_COMPOSITE -
Data type: TWPTEMP-TWPFLAGOptional: No
Call by Reference: No ( called with pass by value option)
ROLE_HAS_USER_ASSIGNMENT -
Data type: TWPTEMP-TWPFLAGOptional: No
Call by Reference: No ( called with pass by value option)
ROLE_IS_A_SAP_ROLE -
Data type: TWPTEMP-TWPFLAGOptional: No
Call by Reference: No ( called with pass by value option)
ROLE_HAS_MENU -
Data type: TWPTEMP-TWPFLAGOptional: No
Call by Reference: No ( called with pass by value option)
LOGSYS -
Data type: TWPSRVTAB-LOGSYSOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for TWP_GET_ROLE_DATA
AGR_DEFINE -
Data type: TWPAGRDEFOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_TCODES -
Data type: TWPAGRTCOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_TIME -
Data type: TWPAGRTIMEOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_CUSTOM -
Data type: TWPAGRCUSTOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_LSD -
Data type: TWPAGRLSDOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_MAPP -
Data type: TWPAGRMAPPOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_MINI -
Data type: TWPAGRMINIOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_MINIT -
Data type: TWPAGRMINTOptional: Yes
Call by Reference: No ( called with pass by value option)
SERVICE_TABLE -
Data type: TWPSRVTABOptional: Yes
Call by Reference: No ( called with pass by value option)
SERVICE_TEXTS -
Data type: TWPSVTEXTSOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_HIER -
Data type: TWPAGRHIEROptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_HIERT -
Data type: TWPAGRHIRTOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_AGRS -
Data type: TWPAGRAGRSOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_TEXTS -
Data type: TWPAGRTEXTOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_BUFFI -
Data type: TWPAGRBUFFOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_ATTS -
Data type: TWPAGRATTSOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_FLAGS -
Data type: TWPAGRFLAGOptional: Yes
Call by Reference: No ( called with pass by value option)
AGR_HPAGE -
Data type: TWPAGRHPAGOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ROLES_NOT_SUPPORTED -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ROLE_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
PARAMETER_ROLE_NAME_EMPTY -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
LOGICAL_SYSTEM_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for TWP_GET_ROLE_DATA 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_role_name | TYPE TWPAGRLIST-AGR_NAME, " | |||
| lt_agr_define | TYPE STANDARD TABLE OF TWPAGRDEF, " | |||
| lv_role_is_composite | TYPE TWPTEMP-TWPFLAG, " | |||
| lv_roles_not_supported | TYPE TWPTEMP, " | |||
| lt_agr_tcodes | TYPE STANDARD TABLE OF TWPAGRTC, " | |||
| lt_agr_time | TYPE STANDARD TABLE OF TWPAGRTIME, " | |||
| lt_agr_custom | TYPE STANDARD TABLE OF TWPAGRCUST, " | |||
| lt_agr_lsd | TYPE STANDARD TABLE OF TWPAGRLSD, " | |||
| lt_agr_mapp | TYPE STANDARD TABLE OF TWPAGRMAPP, " | |||
| lt_agr_mini | TYPE STANDARD TABLE OF TWPAGRMINI, " | |||
| lt_agr_minit | TYPE STANDARD TABLE OF TWPAGRMINT, " | |||
| lt_service_table | TYPE STANDARD TABLE OF TWPSRVTAB, " | |||
| lt_service_texts | TYPE STANDARD TABLE OF TWPSVTEXTS, " | |||
| lt_agr_hier | TYPE STANDARD TABLE OF TWPAGRHIER, " | |||
| lv_role_not_found | TYPE TWPAGRHIER, " | |||
| lv_role_has_user_assignment | TYPE TWPTEMP-TWPFLAG, " | |||
| lv_no_users_from_composite_roles | TYPE TWPTEMP-TWPFLAG, " 'X' | |||
| lt_agr_hiert | TYPE STANDARD TABLE OF TWPAGRHIRT, " | |||
| lv_migrate_services | TYPE TWPTEMP-TWPFLAG, " 'X' | |||
| lv_role_is_a_sap_role | TYPE TWPTEMP-TWPFLAG, " | |||
| lv_parameter_role_name_empty | TYPE TWPTEMP, " | |||
| lt_agr_agrs | TYPE STANDARD TABLE OF TWPAGRAGRS, " | |||
| lv_role_has_menu | TYPE TWPTEMP-TWPFLAG, " | |||
| lv_logical_system_error | TYPE TWPTEMP, " | |||
| lv_only_following_language | TYPE TWPAGRTEXT-SPRAS, " | |||
| lv_logsys | TYPE TWPSRVTAB-LOGSYS, " | |||
| lt_agr_texts | TYPE STANDARD TABLE OF TWPAGRTEXT, " | |||
| lv_optimized | TYPE TWPTEMP-TWPFLAG, " | |||
| lt_agr_buffi | TYPE STANDARD TABLE OF TWPAGRBUFF, " | |||
| lt_agr_atts | TYPE STANDARD TABLE OF TWPAGRATTS, " | |||
| lt_agr_flags | TYPE STANDARD TABLE OF TWPAGRFLAG, " | |||
| lt_agr_hpage | TYPE STANDARD TABLE OF TWPAGRHPAG. " |
|   CALL FUNCTION 'TWP_GET_ROLE_DATA' " |
| EXPORTING | ||
| ROLE_NAME | = lv_role_name | |
| NO_USERS_FROM_COMPOSITE_ROLES | = lv_no_users_from_composite_roles | |
| MIGRATE_SERVICES | = lv_migrate_services | |
| ONLY_FOLLOWING_LANGUAGE | = lv_only_following_language | |
| OPTIMIZED | = lv_optimized | |
| IMPORTING | ||
| ROLE_IS_COMPOSITE | = lv_role_is_composite | |
| ROLE_HAS_USER_ASSIGNMENT | = lv_role_has_user_assignment | |
| ROLE_IS_A_SAP_ROLE | = lv_role_is_a_sap_role | |
| ROLE_HAS_MENU | = lv_role_has_menu | |
| LOGSYS | = lv_logsys | |
| TABLES | ||
| AGR_DEFINE | = lt_agr_define | |
| AGR_TCODES | = lt_agr_tcodes | |
| AGR_TIME | = lt_agr_time | |
| AGR_CUSTOM | = lt_agr_custom | |
| AGR_LSD | = lt_agr_lsd | |
| AGR_MAPP | = lt_agr_mapp | |
| AGR_MINI | = lt_agr_mini | |
| AGR_MINIT | = lt_agr_minit | |
| SERVICE_TABLE | = lt_service_table | |
| SERVICE_TEXTS | = lt_service_texts | |
| AGR_HIER | = lt_agr_hier | |
| AGR_HIERT | = lt_agr_hiert | |
| AGR_AGRS | = lt_agr_agrs | |
| AGR_TEXTS | = lt_agr_texts | |
| AGR_BUFFI | = lt_agr_buffi | |
| AGR_ATTS | = lt_agr_atts | |
| AGR_FLAGS | = lt_agr_flags | |
| AGR_HPAGE | = lt_agr_hpage | |
| EXCEPTIONS | ||
| ROLES_NOT_SUPPORTED = 1 | ||
| ROLE_NOT_FOUND = 2 | ||
| PARAMETER_ROLE_NAME_EMPTY = 3 | ||
| LOGICAL_SYSTEM_ERROR = 4 | ||
| . " TWP_GET_ROLE_DATA | ||
ABAP code using 7.40 inline data declarations to call FM TWP_GET_ROLE_DATA
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.| "SELECT single AGR_NAME FROM TWPAGRLIST INTO @DATA(ld_role_name). | ||||
| "SELECT single TWPFLAG FROM TWPTEMP INTO @DATA(ld_role_is_composite). | ||||
| "SELECT single TWPFLAG FROM TWPTEMP INTO @DATA(ld_role_has_user_assignment). | ||||
| "SELECT single TWPFLAG FROM TWPTEMP INTO @DATA(ld_no_users_from_composite_roles). | ||||
| DATA(ld_no_users_from_composite_roles) | = 'X'. | |||
| "SELECT single TWPFLAG FROM TWPTEMP INTO @DATA(ld_migrate_services). | ||||
| DATA(ld_migrate_services) | = 'X'. | |||
| "SELECT single TWPFLAG FROM TWPTEMP INTO @DATA(ld_role_is_a_sap_role). | ||||
| "SELECT single TWPFLAG FROM TWPTEMP INTO @DATA(ld_role_has_menu). | ||||
| "SELECT single SPRAS FROM TWPAGRTEXT INTO @DATA(ld_only_following_language). | ||||
| "SELECT single LOGSYS FROM TWPSRVTAB INTO @DATA(ld_logsys). | ||||
| "SELECT single TWPFLAG FROM TWPTEMP INTO @DATA(ld_optimized). | ||||
Search for further information about these or an SAP related objects