You are on page 1of 11

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Applies to:
SAP Business Intelligence (BI 7.0). For more information, visit the EDW homepage

Summary
This article describes first how to create a view on two or more tables. Then how to load data through generic datasource based on that view. Here I have used BI tables and datasource created on BI server. But the same procedure we can follow if we need to load data from R/3. Author: Indrashis Bose
th

Company: Accenture Services Pvt Ltd (Mumbai/India) Created on: 11 September, 2011

Author Bio
Indrashis Bose is a SAP BI consultant currently working with Accenture Services Pvt Ltd in Mumbai, India. He is working in SAP BI for the last 1+ year and he has experiences in development/support activities. He is presently working in a support project and enriching his experiences in variouis support related issues.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 1

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Table of Contents:
Scenario: ............................................................................................................................................................. 3 Creating view on two tables: ............................................................................................................................... 4 Creating Generic Datasource based on view: .................................................................................................... 5 Replicating datasource in BI: .............................................................................................................................. 7 Creating Infopackage and Loading data: ............................................................................................................ 8 Related Contents .............................................................................................................................................. 10 Disclaimer and Liability Notice .......................................................................................................................... 11

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 2

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Scenario:
In SAP BI, data are stored in many tables. Some time it may be required that we need to load data combining two or more tables i.e. taking different fields from different tables based on a condition. Then it is very useful to create a view on those tables and loading data through a generic datasource on that view. We may need to load data from R/3 tables to BW system or may be from BW tables. Here I have explained using BW tables. But the same procedure should be followed in case source is R/3 system. We need to create view and datasource in R/3 system. Then we need to replicate that datasource in BI system. We have two employee tables Employee table 1 (ZTABLE1_EMP) and Employee table 2 (ZTABLE2_EMP). Table 1 contains Employee No, Employee Address, Employee Phone and Employee Name.

Table 2 contains Employee No, Employee Grade and Employee Email.

Now we have a requirement that we need to load Employee No, Employee Name and Employee Email. First two fields come from table 1 and the third from table 2. So here we will create a view on these two tables and then we will create a generic datasource on that view to load data. Lets us go step by step to load the data,

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 3

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Creating view on two tables:


As per our requirement we have to first create a view on our two employee tables Employee Table 1 (ZTABLE1_EMP) and Employee Table 2 (ZTABLE2_EMP). First go to se11 and select view. Give view name as ZVIEW_EMP and click on create.

Then a pop up window will come. Select Database view and click on copy.

Then in the next screen give description as Employee view. Then give the tables name that we are using ZTABLE1_EMP & ZTABLE2_EMP. Then give the join condition that we are using i.e. Employee No of table 1 is equal to Employee Nop of table 2.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 4

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Then go to View Fields tab. There give the different fields that we want to see from different tables. The left column is for field description in view. The middle column contains table name and the right column contains the respective field of that table. Here we want to see 3 fields - Employee No and Employee Name from table 1 and Employee Email from table 2. And then activate the view.

Then again go to se11 and select view. There give the view name as ZVIEW_EMP and click on display. There check the contents of the view and see whether the records are coming properly.

Now we can say that our creation of view is complete. Now we have to make the data source on this view.

Creating Generic Datasource based on view:


We have the tables and view in BI server. And we are creating datasource also in BI system. If we need to extract data from R/3, we need to follow the same procedure but we need to do all the steps in R/3 system. To create a generic datasource, we need to go to RSO2. There choose the datasource type and give the technical name of the datasource. Here we are giving ZDATAS_EMP and click on create.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 5

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Then in the next screen, give application component as BW. Give the datasource description. As we are extracting from Database View, so give the view name in the specified area. Then click on save.

Then a new window will open. You can see the extract structure there. Check all the three fields that we want to see. Then again click on save.

Then you will again go to the first screen> Just click on save and your datasource will be saved.

Now datasource is created but we need to replicate the datasource. Now we need to check whether our datasource is ready to be replicated. For that go to tcode RSA6. There under BW node, check whether you can see your datasource.

Now our datasource is ready to be replicated. We need to replicate it now.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 6

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Replicating datasource in BI:


For replicating the datasource, we need to go to RSA1 and then go to datasource. At the top left corner there is a button to chose source system. Choose source system as BI system.

Then in the next screen, right click on BW datasources at the top and click on replicate metadata.

Then you will get a pop up that ZDATAS_EMP does not exist in BI and will create the datasource in BI. Choose RSDS as type of the datasource.

It may take some time to replicate the datasource. After replication is complete you can see your datasource under BW datasources. This means datasource is ready. Now we just need to create infopackage to load data to PSA.

Remember one thing We need to follow exact same procedure if we need to load data from R/3. We will follow every step before replicating the datasource in R/3 system i.e. we will create view and the datasource in R/3 system. Then in BI system we will replicate the datasource. Then we just need to choose source system as R/3 instead of BI.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 7

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Creating Infopackage and Loading data:


For creating infopackage, right click on the datasource and click on create infopackage.

Then give the infopackage description and click on save.

Then go to infopackage schedule tab and click on start.

Then your data will be loaded to PSA.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 8

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Now loading upto PSA is complete using generic datasource. Now you can easily create transformation / DTP and load data to any infoprovider from the datasource.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 9

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Related Contents
Database Views Generic Extraction using function module Maintaining Generic datasources

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 10

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 11

You might also like