1/12/2007

Customizing SAP Portal Master Header for Branding

SAP Enterprise Portal provides Theme Editor to edit the themes/styles for Portal environment. We can change the branding by changing the masthead part in the theme editor. But if you want to reposition the elements, add new elements or require more customizations then changing the code is a way to go. But before changing the code, it would be a better idea to check whether by editing the themes will suffice.

Changing the Code:

To change the masthead by changing the code, it would be a better idea to get the existing masthead par file and use it as a starting point. We can even develop whole new portal component using framework library and make it an iview out of it.

To get the mastead par file, go to System Administration -->Support --> Browse Deployment and browse to the directory ROOT/WEB-INF/deployment/temp and you will find com.sap.portal.navigation.masthead.par.bak file. Download it to your local system. If you observe the file extension, it is "bak", because SAP Portal renames the archives after it deployes the par so that it will not deploy it again. Remove the file extension .bak and rename according to the naming standards of your organization. I would recommend you to use the same naming of the file, remove "sap" and use your own company name, like com.mycompany.portal.navigation.masthead.par. After this, you can import this par file in NWDS (Netweaver Developer Studio) by selecting File --> Import. A word of caution, the importing does not import the jar files in the private/lib folder of the project structure. So, copy them manually to the new project you have created.

When you see the project structure, you can find the header related file in dist --> PORTAL-INF -->jsp --> Headerview.jsp. You can change this file according to your needs and deploy it back to the portal.

Create an iView:

In the portal environment, you can create iView out of this new portal component you just uploaded. To do this,go to Content Administration--> Portal Content --> Portal Content and I recommend creating a folder for placing all the customization related objects (iviews, framework page, portal desktop). To create an iview in the newly created folder, right click on the folder name and select "New iview from Par" (In Netweaver 2004s, select "new --> iview" and in the next step select the appropriate option for creating an iview from the portal component). Select the portal application (par file name) you just deployed to portal and select the portal component. It'll create the iview based on the portal component we just changed.


Framework Page:
For testing, we can create a portal framework page (just copy the standard portal framework page available at Portal Content -->Portal Users --> Standard Portal Users -->Default Framework Page ). Open the copied Framework page for editing and make visible checkbox unchecked for exisitng Mastehead iView and add the new masthead iview just created. Go to Page Layout and arrange the masthead so that it appears on the top.


Portal Desktop:
Now, copy the SAP provided standrd Portal Desktop object to the folder we created for placing the custom content. To do this, go to System Administration --> Portal Display -->Desktops & Display Rules and browse to Portal Content -->Content Provided by SAP --> End User Content -->Standard Portal Users and copy Default Portal Desktop and paste it in the your folder. Now, open the copied portal desktop object and add the newly created framework page and make it default framework page for this desktop object.


Changing Master Rule Collection:
Now, you can change the Master Rule Collection which controls the desktop selection for end users based on the criteria specified. To open the Master Rule Collection, go to System Administration --> Portal Display -->Desktops & Display Rules and browse to Portal Content -->Portal Administrators -->Super Administrators --> Master Rule Collection. Add a new rule for displaying the newly created desktop for some user in portal (testing purpose), save the object and close it.


Result:
You can now go and check the new portal desktop containing the new masthead you just created by logging into the portal as the user for whom you set the new rule.