Skip to Content
Technical Articles
Author's profile photo Mazhar Ansari

Invalidating Client Cache or Deleting User Personalization

Note:  You only need to run the program /UI2/INVALIDATE_CLIENT_CACHES in exceptional cases.

Prerequisites

To invalidate other users’ caches, you need to have PFCG role SAP_UI2_ADMIN_700 assigned. For more information, see Authorizations.

Information

You only need to run this program in exceptional cases if you need to invalidate specific resources. These resources include data originating from OData service requests of the launchpad itself (not from SAP Fiori apps), like target mappings and personalization data, as well as a few very specific application resources that use the global cache buster token. For more information on the latter, see Cache Buster for SAP Fiori Launchpad and SAP Fiori Apps.

 

Procedure

  1. Start transaction SE38.
  2. Execute the program /UI2/INVALIDATE_CLIENT_CACHES.Figure 1: Executing the program /UI2/INVALIDATE_CLIENT_CACHES  from SE38 transaction.
  3. Select the users for whom you want to invalidate the cache:
    Option Description
    For all users Invalidate the cache for all users (including the current user).
    For user Invalidate the cache for a specific user by specifying a user name.

    Figure 2: Program /UI2/INVALIDATE_CLIENT_CACHES  has been executed.

  4. Choose .

Results

The system invalidates the client caches.

Every cache invalidation is logged in the Application Log (transaction SLG1), using object /UI2/BE and subobject /UI2/CLEANUP_CACHES.

 

Procedure to check cache invalidations in Application Log

  1. Start transaction SLG1.
  2. Specify the object, subobject and date/time fields  as shown belowFigure 3: Providing Object, Subobject and date/time fields in SLG1 transaction.
  3. Choose .

Now you will be able to see the display log screen as below

Figure 4: Display Logs.

 

Removing Personalization

Use

The portal provides a tool called Personalization Cleanup that enables an administrator to remove a specific user’s personalization on a specific object.

This is particular useful when an attribute is defined in the portalapp.xml of a portal component, then is personalized, and then needs to be updated in the portalapp.xml . After the new portal component is deployed, the personalized value is still present in the PCD, and supercedes even the new value in the portalapp.xml .

 

Running Personalization Cleanup

To run the tool, go to System Administration > Support  > Portal Content Directory > Personalization Cleanup

Figure 5: Personalization Cleanup Window.

 

To remove personalization for a specific object, do one of the following:

  • Search by Object

    1. Select the Object radio button.

    2. Enter the PCD name of the object (without the pcd: prefix)

    3. Click Show . All users with personalization for the specified object are displayed.

    4. Select the users whose personalization you want to remove.

    5. Click Remove .

  • Search by User, Group or Role (Principal)

    1. Select the Principal radio button.

    2. Enter a search string for the user, group or role whose personalization you want to remove.

    3. Click Show . All users who fit the search string and with any personalization in the PCD are displayed.

    4. Select the logon ID of the user, group or role whose personalization you want to remove. All objects personalized by the selected principal are displayed.

    5. Select the objects from which you want to remove personalization for the selected user, group or role.

    6. Click Remove .

 

Removing Personalization via Code (Alternative)

 

Personalization can be removed by performing a personalized lookup (a lookup in which a personalization principal is specified), and then removing some or all of the modifications by calling removeModifications() or removeAttributeModifications() on the IPcdContext object. This removes the personalization for the user specified as the personalization principal.

These are the same methods for removing delta link modifications when performing a nonpersonalized lookup.

The following removes all personalization from an object for the current user:

 

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,
IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL, request.getUser());

InitialContext iCtx = null;

String myObjectName = "pcd:portal_content/myFolder/myObject";

try {
iCtx = new InitialContext(env);

IPcdContext myObject = (IPcdContext) iCtx.lookup(myObjectName);

myObject.removeModifications("");
}
catch (Exception e) {}

 

Summary

I would like to conclude that by reading this blog you will learn how to invalidate client cache and delete user personalization. Your feedback is valuable to me so please do share your feedback and thoughts in the comment box.

You can refer to other resources on SAP Fiori using the following links:

SAP Fiori Topic Page  https://community.sap.com/topics/fiori

Ask questions about SAP Fiori and follow https://answers.sap.com/tags/73554900100700000977

Read other SAP Fiori blog posts and follow https://blogs.sap.com/tags/73554900100700000977/

Please follow my profile for future posts https://people.sap.com/mazhar74258

 

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo PRASHANT SHARMA
      PRASHANT SHARMA

      Thanks a lot Mazhar for sharing. Very helpful.

      Author's profile photo Mazhar Ansari
      Mazhar Ansari
      Blog Post Author

      Thanks a lot Prashant 😎🙂Really appreciate it.