SAP SET_USAGE_LIBRARY Function Module for Maintenance of Set Usage in Libraries
SET_USAGE_LIBRARY is a standard set usage library SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Maintenance of Set Usage in Libraries processing and below is the pattern details for this FM, 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 set usage library FM, simply by entering the name SET_USAGE_LIBRARY into the relevant SAP transaction such as SE37 or SE38.
Function Group: RGSU
Program Name: SAPLRGSU
Main Program: SAPLRGSU
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function SET_USAGE_LIBRARY 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 'SET_USAGE_LIBRARY'"Maintenance of Set Usage in Libraries.
EXPORTING
* CLIENT = "Client
IN_FUNCTION = "Insert, Delete, Delete All (I/D/A)
IN_LIB = "Library
IN_TYP = "D (Default) / I (Report-Report-Interface)
SET_ID = "Set Used
* SET_TABLE = ' ' "Table of Set Used
IMPORTING Parameters details for SET_USAGE_LIBRARY
CLIENT - Client
Data type: SY-MANDTOptional: Yes
Call by Reference: No ( called with pass by value option)
IN_FUNCTION - Insert, Delete, Delete All (I/D/A)
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
IN_LIB - Library
Data type: T801K-LIBOptional: No
Call by Reference: No ( called with pass by value option)
IN_TYP - D (Default) / I (Report-Report-Interface)
Data type: T801M-RCOptional: No
Call by Reference: No ( called with pass by value option)
SET_ID - Set Used
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
SET_TABLE - Table of Set Used
Data type: SETHIER-TABNAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SET_USAGE_LIBRARY 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_client | TYPE SY-MANDT, " | |||
| lv_in_function | TYPE C, " | |||
| lv_in_lib | TYPE T801K-LIB, " | |||
| lv_in_typ | TYPE T801M-RC, " | |||
| lv_set_id | TYPE C, " | |||
| lv_set_table | TYPE SETHIER-TABNAME. " SPACE |
|   CALL FUNCTION 'SET_USAGE_LIBRARY' "Maintenance of Set Usage in Libraries |
| EXPORTING | ||
| CLIENT | = lv_client | |
| IN_FUNCTION | = lv_in_function | |
| IN_LIB | = lv_in_lib | |
| IN_TYP | = lv_in_typ | |
| SET_ID | = lv_set_id | |
| SET_TABLE | = lv_set_table | |
| . " SET_USAGE_LIBRARY | ||
ABAP code using 7.40 inline data declarations to call FM SET_USAGE_LIBRARY
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 MANDT FROM SY INTO @DATA(ld_client). | ||||
| "SELECT single LIB FROM T801K INTO @DATA(ld_in_lib). | ||||
| "SELECT single RC FROM T801M INTO @DATA(ld_in_typ). | ||||
| "SELECT single TABNAME FROM SETHIER INTO @DATA(ld_set_table). | ||||
| DATA(ld_set_table) | = ' '. | |||
Search for further information about these or an SAP related objects