Wednesday, 9 March 2016

Inactive versions - Switch Ownership

Multiple developers work on modeling Information views based on many tables belongs to schema. The information views will become Active version of object only when it is 'Activated' after 'Save and Validation'. After building the information view if the user only 'save and validate' and does not activate, it becomes the Inactive version of the object.

If one user just created the object, then it is possible to take over that object by another user as long as it is inactive version of the object. This concept is called as "Take Over" or "Switch Ownership". The difference between these two is:

Take Over: To take single inactive object from another workspace.
Switch Ownership: To take single or multiple inactive objects from other users.

In this blog we will have a look on Switch Ownership (version SPS 05 Revision 47).
For simplicity we assume that there are two users (USER1 , USER2) working on two tables (EMPLOYEE, DEPT) on which Analytic view is based on schema "SRK" and both the users have the same privileges but USER1 developing views in system (HAN(USER1)) and USER2 in system (HAN(USER2)).

Prerequisites:
1.There should be at-least two Systems

SAP HANA Certifications and Material

2. One extra privilege is required by the user who is taking over the object (will be mentioned in the below subsequent step).

Steps:
1. First let us create the inactive object (by the user USER1)- Analytic view (AN_EMP_DEPT). So switch to system (HAN(USER1)) from the Quick Launch and click "Select System"

SAP HANA Material and Cerifications

2. Create Analytic view from the system (HAN(USER1)) as 'AN_EMP_DEPT' by using the tables 'EMPLOYEE' and 'DEPT' from the schema 'SRK' in package 'srk' and just click "Save and Validate" but do not click Activate.

Inactive versions - Switch Ownership

3. Close the view window and we can now see the inactive object of Analytic view.

Inactive versions - Switch Ownership

4. Now this object is ready to take over by other user (USER2). Change the System to HAN(USER2) from the Quick Launch menu as shown in Step 1.

5. Now click 'Switch Ownership' and we will get error, as the USER2 does not have the privilege to work in a foreign workspace as shown below.

Inactive versions - Switch Ownership

5. Click OK and open the other system (HAN(SYSTEM)) -> Expand Security folder -> Edit the user USER2 to add the 'System privilege' "REPO.WORK_IN_FOREIGN_WORKSPACE".

Inactive versions - Switch Ownership

6. Back to Quick Launch menu, make sure the system is HAN(USER1), and click 'Switch Ownership'. This time we will  see a window and in Source User select 'User1'

SAP HANA Switch Ownership

7. It will now display all the Inactive objects owned by USER1. We can select all or selected objects. In this case we will select only our Inactive object (AN_EMP_DEPT) and click Add and it comes into Target user USER2 and click ok.

Inactive versions - Switch Ownership

8. Switch ownership job will run and upon successful completion, refresh both the systems and the inactive object is now move to system HAN(USER2) from HAN(USER1).

SAP HANA Material and Tutorial

9. 'Save and Validate' our analytic view and now 'Activate' the analytic view. Upon successful completion of job, it becomes an active version. Now you can do Data preview to see the data.

10. Double click the Analytic view and click on the Switch Version icon as shown below.

SAP HANA Certifications and Material

11. It copies the active version of the object and places back in the package of the user USER1.

SAP HANA Certifications and Material

Finally we are done with taking over of inactive version, do changes if required, save and validate, activate and then Switch version to copy back to its original user . That's all

Source: scn.sap.com