!--a11y-->
The methods of class CL_PERS_ADMIN are used to store data in the generic repository.
Class CL_PERS_ADMIN | |
get_data |
Read the user data |
set_data |
Write the user data |
get_data_role |
Read the role data |
set_data_role |
Write the role data |
get_data_system |
Read the system data |
set_data_system |
Write the system data |
save_buffer |
Store the buffered data |
get_object |
Get a personalization object for the user |
get_object_role |
Get a personalization object for a role |
get_object_system |
Get a personalization object for the system |
dialog |
Dialog call (not yet active) |
dialog_role |
Dialog call for role objects (not yet active) |
Dialog_system |
Dialog call for system objects (not yet active) |
There are two ways to access the personalization data. You can read or write the data directly or you can modify the data with an ABAP object.
The SET_DATA, SET_DATA_ROLE and SET_DATA_SYSTEM methods are used to write personalization data directly.
In the example, the data from demo_data is stored under the key DEMO_KEY for user SY-UNAME.
Parameter |
Type |
Meaning |
p_pers_key |
SPERS_KEY |
Key for the personalization data: This key was assigned when the personalization object was registered |
p_uname |
UNAME |
Name of the user whose data should to be read |
p_pers_data |
ANY |
Personalization data |
p_write_through |
CHAR1 |
Flag for avoiding buffering: If the flag is 'X', the data is immediately written to the database. |
p_append |
CHAR1 |
Flag for appending data: If the flag is 'X', the data is appended. To read the data again at a later time, you must use an internal table with the corresponding row type. |
p_modify |
CHAR1 |
Flag for modifying data (internal tables): If the flag is set, the data in the repository whose key fields are identical to the data that was passed is replaced. This parameter can only be used in connection with p_append = 'X'. The key fields are passed in parameter p_key_tab. |
p_key_tab |
SPERS_SELT |
List of the key fields for the modification. |
The SET_DATA_AGR and SET_DATA_SYSTEM methods can be used in a similar manner.
The GET_DATA, GET_DATA_AGR and GET_DATA_SYSTEM methods are used to read data directly.
In the example, the personalization data under key DEMO_KEY for user SY-UNAME is read into variable demo_data. The data for the roles to which the user is assigned can be found in table demo_data_list.
Parameter |
Type |
Meaning |
p_pers_key |
SPERS_KEY |
Key for the personalization data: This key was assigned when the personalization object was registered |
p_uname |
UNAME |
Name of the user whose data should be read |
p_user_data_only |
CHAR1 |
If the flag is 'X', only the data for the user is read. The data for the assigned roles is not read. |
p_refresh_buffer |
CHAR1 |
Flag for avoiding buffering: If the flag is 'X', the data is read directly from the database, ignoring the buffer. |
p_pers_data |
ANY |
Personalization data |
p_pers_data_list |
SPERS_ADT |
Personalization data for the roles the user is assigned to. The table contains the role names and a reference to the personalization data |
p_sel_tab |
SPERS_SELT |
Table with selection conditions (internal tables): The internal table contains combinations of fields and values for the data selection. |
p_sel_cond_and |
CHAR1 |
AND operation for the selection conditions. |
The GET_DATA_AGR and GET_DATA_SYSTEM methods can be used in a similar manner.
If the personalization data was not written directly to the database, the buffered data can be saved with the SAVE_BUFFER method. All the data in the personalization repository is stored when the method is called.
The USER_DIALOG, ROLE_DIALOG and SYSTEM_DIALOG methods are used to call the dialog.
In the example, a dialog is called for the personalization object with the key DEMO_KEY for user SY-UNAME. The data initially remains in the buffer.
Parameter |
Type |
Meaning |
p_pers_key |
SPERS_KEY |
Key for the personalization data: This key was assigned when the personalization object was registered |
p_uname |
UNAME |
Name of the user whose data should be read |
p_check_user |
CHAR1 |
If the flag is 'X', there is a check whether the user exists. |
p_commit |
CHAR1 |
Flag for avoiding buffering: If the flag is 'X', the data is written directly to the database. |
The ROLE_DIALOG and SYSTEM_DIALOG methods can be used in a similar manner.
The DELETE_DATA_USER, DELETE_DATA_ROLE and DELETE_DATA_SYSTEM methods can be used to delete personalization data from the generic repository.
In the example, the data for user SY-UNAME and the key DEMO_KEY are deleted.
Parameter |
Type |
Meaning |
p_pers_key |
SPERS_KEY |
Key for the personalization data: This key was assigned when the personalization object was registered |
p_uname |
UNAME |
Name of the user whose data should be read |
p_sel_tab |
SPERS_SELT |
Table with selection conditions (internal tables): The internal table contains combinations of fields and values for selecting data. |
p_sel_cond_and |
CHAR1 |
AND operation for the selection conditions |
p_buffer_only |
CHAR1 |
If the flag is set, only the buffer table is deleted. |
The DELETE_DATA_ROLE and DELETE_DATA_SYSTEM methods can be used in a similar manner.
Accessing the Personalization Data with an ABAP Object
With the GET_OBJECT, GET_OBJECT_AGR and GET_OBJECT_SYSTEM methods, you can read an ABAP object that can also be used to modify the personalization data for a key.
In the example, a personalization object is read into reference variable pers_objekt under key DEMO_KEY for user SY-UNAME.
Parameter P_USER_DATA_ONLY defines if the objects for the roles assigned to the user should also be read. The role objects are exported in parameter P_OBJECTS_AGR.
With parameter P_RFC you can define an RFC destination with which the data should be read.
The personalization object belongs to class CL_PERS_OBJECT_DATA. Methods SET_DATA, GET_DATA, SAVE_OBJECT_DATA and DIALOG can be used to access the data.
Writing the Data with the ABAP Object
Write access to the data of a personalization object uses method SET_DATA.
In the example, the data from variable demo_data are written directly to the central repository. The parameters have the same meaning as for writing data.
Reading the Data with the ABAP Object
Read access to the data of a personalization object uses method GET_DATA.
In the example, the data of the personalization object are read from the database into field demo_data. The parameters have the same meaning as for reading data directly.
Calling the Maintenance Dialog
The maintenance dialog for a personalization object is called with the DIALOG method.
In the example, the dialog for a personalization object is called. The changes made to the data are written directly to the database since parameter p_commit was set to 'X'.
To call a dialog, a dialog must be defined for the key of the personalization object. A corresponding function module must have been implemented in this case (see below.).
Saving the Buffered Data
If the data was not written directly to the database, it can be saved with the SAVE_OBJECT_DATA method. The method has parameter P_BACKGROUND. If the parameter is set to 'X', a background process is started to store the data.
Deleting Data
The DELETE_DATA method can be used to delete data.
In the example the data is deleted without a selection parameter.
Parameter |
Type |
Meaning |
p_sel_tab |
SPERS_SELT |
Table with selection conditions (internal tables): The internal table contains combinations of fields and values for selecting data. |
p_sel_cond_and |
CHAR1 |
AND operation for the selection conditions |
p_buffer_only |
CHAR1 |
If the flag is set, only the buffer table is deleted. |