Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
22,569
Fiori Default Theme / FLP Customizing default theme parameter and Personalization

As we know we can change the default theme parameter with tcode /UI2/NWBC_CFG_CUST.



This default theme parameter will be applied for the users who have not changed their theme from user preferences previously.

Let's assume that customized and defaulted theme is THEME_A. The users who have not changed their theme through Fiori->User Preferences will see THEME_A as their default theme. But if they change their theme to some other theme like THEME_B through Fiori->User Preferences they will not get effected from customized default theme. They will be seeing THEME_B whatever the default theme is. This is because of the personalization data which is defaulted for the user with the activity of changing theme.
We can see the values in table SPERS_OBJ with keys 'PERS_KEY' as '/UI2/USER_PROFILE' and 'OBJECT_ID' as username.



If we have a value set for the user in this tabke it will not get the defaulted theme from customizing. And will use the theme defined here.
There are multiple ways to handling this issue. Two ways explained for quick reference.

1-)  From SU01 - Personalization Tab you can reset the values for '/UI2/USER_PROFILE'. This activity will delete the table records in SPERS_OBJ with keys 'PERS_KEY' as '/UI2/USER_PROFILE' and 'OBJECT_ID' as username and customized default theme will be shown instead.



2-)For mass operations on personalization data specific to the theme in order to update '/UI2/USER_PROFILE' value for users you can use a program as below. You can also enhance the program different way of usages.
REPORT zfiori_theme.

TABLES: suid_st_bname.
DATA: lt_spers_obj TYPE TABLE OF spers_obj WITH HEADER LINE.
DATA: lv_spers_fld TYPE spers_fld.

DATA: BEGIN OF tp_s_user_profile_base,
uname TYPE syuname,
id TYPE string,
shell_type TYPE string,
value TYPE string,
data_type TYPE string,
edit_state TYPE i,
validation_mask TYPE string,
END OF tp_s_user_profile_base .
DATA: s_obj TYPE RANGE OF spers_obj-object_id,
sr_obj LIKE LINE OF s_obj.

DATA: lv_uname TYPE sy-uname.
DATA: pers_data LIKE TABLE OF tp_s_user_profile_base,
pers_data_list TYPE spers_adt.

SELECT-OPTIONS: s_user FOR suid_st_bname-bname.
PARAMETERS p_theme TYPE /ui2/nwbc_cfg_param_value.

START-OF-SELECTION.

LOOP AT s_user REFERENCE INTO DATA(lsr_user).
CLEAR: sr_obj.
sr_obj-sign = lsr_user->sign.
sr_obj-option = lsr_user->option.
sr_obj-low = lsr_user->low.
sr_obj-high = lsr_user->high.
APPEND sr_obj TO s_obj.
ENDLOOP.

SELECT * FROM spers_obj INTO TABLE lt_spers_obj
WHERE pers_type EQ 'U'
AND object_id IN s_obj
AND pers_key EQ '/UI2/USER_PROFILE'
AND fieldname EQ 'VALUE'.

END-OF-SELECTION.

lv_spers_fld = p_theme.

LOOP AT lt_spers_obj.

CLEAR: pers_data, pers_data[], lv_uname.

lv_uname = lt_spers_obj-object_id.

CALL METHOD cl_pers_admin=>get_data
EXPORTING
p_pers_key = '/UI2/USER_PROFILE'
p_uname = lv_uname
p_user_data_only = ' '
IMPORTING
p_pers_data = pers_data
p_pers_data_list = pers_data_list.

LOOP AT pers_data ASSIGNING FIELD-SYMBOL(<fs_pers>).
<fs_pers>-value = lv_spers_fld.
ENDLOOP.

CALL METHOD cl_pers_admin=>set_data
EXPORTING
p_pers_key = '/UI2/USER_PROFILE'
p_uname = lv_uname
p_pers_data = pers_data
EXCEPTIONS
pers_key_not_found = 1
data_type_error = 2
user_does_not_exist = 3
not_set_to_default = 4
pers_key_locked = 5
OTHERS = 6.
IF sy-subrc EQ 0.
WRITE:/ lv_uname, (50) 'Updated'.
ELSE.
WRITE:/ lv_uname, (50) 'NON-Error'.
ENDIF.
ENDLOOP.
5 Comments
Labels in this area