Show TOC

Using the Generic Storage TableLocate this document in the navigation structure

To store data in the generic storage table, use the methods of the class CL_PERS_ADMIN.

Method Description

get_data

Read the data about the user

set_data

Write the data about the user

get_data_role

Read the data about a role

set_data_role

Write the data about a role

get_data_system

Read the data about the system

set_data_system

Write the data about the system

save_buffer

Save 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

user_dialog

Dialog call for objects for users

role_dialog

Dialog call for objects for roles

system_dialog

Dialog call for objects for the system

There are essentially two ways to access personalization data. You can read or write the data directly or manipulate the data using an ABAP object.

Writing Data Directly

Use the SET_DATA, SET_DATA_ROLE, and SET_DATA_SYSTEM methods to write personalization data directly.

Example of Writing Data Directly to the Generic Storage Table

In the example, the data from demo_data is stored under the key DEMO_KEY for user SY-UNAME.

Parameter Type Description

p_pers_key

SPERS_KEY

Key for personalization data.

This key was assigned when the personalization object was registered.

p_uname

UNAME

Name of the user whose data is to be read.

p_pers_data

ANY

Personalization data

p_write_through

CHAR1

Indicator for avoiding buffering:

If the indicator is set to X, the data is immediately written to the database.

p_append

CHAR1

Indicator for appending data:

If the indicator is set to 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

Indicator for modifying data (internal tables):

If the indicator is set, the data in the storage table whose key fields are identical to the data that was passed is replaced.

The parameter can only be used in connection with p_append = 'X'.

The key fields are passed in the 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.

Reading Data Directly

The GET_DATA, GET_DATA_AGR, and GET_DATA_SYSTEM methods are used to read data directly.

Reading Data Directly from the Generic Storage Table

In the example, the personalization data under the key DEMO_KEY for user SY-UNAME is read into the variable demo_data. The data for the roles which the user is assigned is in the table demo_data_list.

Parameter Type Description

p_pers_key

SPERS_KEY

Key for personalization data.

This key was assigned when the personalization object was registered.

p_uname

UNAME

Name of the user whose data is to be read.

p_user_data_only

CHAR1

If the indicator is set to X, only the data for the user is read. The data for the assigned roles is not read.

p_refresh_buffer

CHAR1

Indicator for avoiding buffering.

If the indicator is set to 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. The table contains the role names and a reference to the personalization data.

p_sel_tab

SPERS_SELT

Table with selection conditions (internal table).

The internal table contains combinations of fields and values for data selection.

p_sel_cond_and

CHAR1

AND linkage for the selection conditions.

The GET_DATA_AGR and GET_DATA_SYSTEM methods can be used in a similar manner.

Saving the Buffered Data

If the personalization data was not written directly to the database, you can save the buffered data using the SAVE_BUFFER method. All the data in the personalization storage table is stored when the method is called.

Calling a Dialog

The USER_DIALOG, ROLE_DIALOG and SYSTEM_DIALOG methods are used to call the dialog.

Calling a Dialog for General Storage

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 Description

p_pers_key

SPERS_KEY

Key for personalization data.

This key was assigned when the personalization object was registered.

p_uname

UNAME

Name of the user whose data is to be read.

p_check_user

CHAR1

If the indicator is set to X, the system checks whether the user exists.

p_commit

CHAR1

Indicator for avoiding buffering:

If the indicator is set to X, the data is written directly to the database.

The ROLE_DIALOG and SYSTEM_DIALOG methods can be used in a similar manner.

Deleting Data

The DELETE_DATA_USER, DELETE_DATA_ROLE, and DELETE_DATA_SYSTEM methods can be used to delete personalization data from the generic storage table.

Deleting User Data

In the example, the data for user SY-UNAME and the key DEMO_KEY is deleted.

Parameter Type Description

p_pers_key

SPERS_KEY

Key for personalization data.

This key was assigned when the personalization object was registered.

p_uname

UNAME

Name of the user whose data is to be read.

p_sel_tab

SPERS_SELT

Table with selection conditions (internal table).

The internal table contains combinations of fields and values for data selection.

p_sel_cond_and

CHAR1

AND linkage for the selection conditions.

p_buffer_only

CHAR1

If the indicator 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

The GET_OBJECT, GET_OBJECT_AGR, and GET_OBJECT_SYSTEM methods can be used to read an ABAP object for a key. You can use this ABAP object to manipulate the personalization data.

Accessing the Personalization Data with an ABAP Object

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 whether the objects for the roles assigned to the user should also be read. The role objects are output in parameter P_OBJECTS_AGR.

You can use parameter P_RFC to specify 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.

Parameter Possible Values Description

p_db_commit

Default value X

space

This parameter allows a call without a commit. The application can itself determine when a commit is performed.

The default value set for the parameter is X, to continue the previous behavior. To override the commit, set p_db_commit = space.

Writing the Data with the ABAP Object

Write access to the data of a personalization object uses method SET_DATA.

Writing Data with the ABAP Object

In the example, the data from variable demo_data is written directly to the central storage table. The parameters have the same meaning as for direct writing of data.

Reading the Data with the ABAP Object

Read access to the data of a personalization object uses method GET_DATA.

Reading Data with the ABAP Object

In the example, the data of the personalization object is read from the database into field demo_data. The parameters have the same meaning as for direct reading of data.

Calling the Maintenance Dialog

The maintenance dialog for a personalization object is called with the DIALOG method.

Calling the Maintenance Dialog

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 has been set to X.

To call a dialog, a dialog must be defined for the key of the personalization object. To do this, you need to implement a corresponding function module.

Saving the Buffered Data

If the data was not written directly to the database, you can save the data using the SAVE_OBJECT_DATA method. This method has the parameter P_BACKGROUND. If the parameter is set to X, a background process is started to store the data.

Deleting Data

You can use the DELETE_DATA method to delete data.

Deleting Data

In the example, data is deleted without a selection parameter.

Parameter Type Description

p_sel_tab

SPERS_SELT

Table with selection conditions (internal table).

The internal table contains combinations of fields and values for data selection.

p_sel_cond_and

CHAR1

AND linkage for the selection conditions.

p_buffer_only

CHAR1

If the indicator is set, only the buffer table is deleted.