lsmw tutorials

24
Step-by-Step tutorial to upload Master Data from Flat File (SourceSystem) to InfoObjects (Master data table) By Lakshmi MP, Perot Systems Basic Steps of Data Flow (ETL process): 1. Determine the Source System (Flat File/SAP R3/WebServices etc) 2. Establish an interface w.r.t the Source system used 3. Create a Data Source – which has a structure similar to the Source structure. Consider two factors : Name of file and Structure same as Source. 4. Create Info Provider to transfer data from Data Source to PSA (Persistent staging Area) 5. Create a Target (Info Provider : InfoObjects/Info Cubes/DSO etc) 6. Create a Transformation rule to map Source & Target fields. 7. Create DTP (Data Transfer Process) to transport data stored within PSA , to the final Data Target. Transaction Code – RSA1 : Data Warehouse Workbench

description

sap abap ,lsmw tutorials.

Transcript of lsmw tutorials

Page 1: lsmw tutorials

Step-by-Step tutorial to upload Master Data from Flat File (SourceSystem) to InfoObjects (Master data table)

By Lakshmi MP, Perot Systems 

Basic Steps of Data Flow (ETL process):

1. Determine the Source System (Flat File/SAP R3/WebServices etc)

2. Establish an interface w.r.t the Source system used

3. Create a Data Source – which has a structure similar to the Source structure. Consider two factors : Name of file and Structure same as Source.  

4. Create Info Provider to transfer data from Data Source to PSA (Persistent staging Area)

5. Create a Target (Info Provider : InfoObjects/Info Cubes/DSO etc)

6. Create a Transformation rule to map Source & Target fields.

7. Create DTP (Data Transfer Process) to transport data stored within PSA , to the final Data Target.  

Transaction Code – RSA1 : Data Warehouse Workbench

Page 2: lsmw tutorials

 

Source/Input: Create a Flat File of type CSV, with the following structure:  

Customer Language Land City Name

260 EN US SEATTLE JOHN

261 DE DE HAMBURG SAM

262 DE DE WALDORF MICHEAL

Right click on the InfoProvider column header. Select “Create InfoArea”  

 

Enter the details – InfoArea name and Description  

Page 3: lsmw tutorials

 

 

The InfoArea – IA for Customer appears on the InfoProvider list.  

Right click on the created InfoArea and create InfoObject Catalog  

Page 4: lsmw tutorials

 

Enter a suitable Name and Description for InfoObject Catalog.

Select ‘Char.’ or ‘Key Figure’ based on the type of data (Master data/ Trans. Data) needs to be created.

In this case, we are creating Master data. Hence, we need to create Characteristics InfoObject.

Select ‘Char.’

Click on Create.  

The InfoObject Catalog appears right under the InfoArea created earlier.

Now, right click on the InfoObject Catalog and create Info Object.  

Page 5: lsmw tutorials

 

In the pop-up for InfoObject enter Characteristic name and description.

The first Characteristic InfoObject created can be treated as a key value in the Master table to be created.  

On the right window, the properties of the Characteristic ‘CUSTNO’ are visible.

In the General Tab, enter the Data Type and Length.

Note: the ‘Attribute Only’ field is not checked. This means that this Characteristic is a primary key field in the Master Data table.

If the box is checked, then it becomes an attribute of this Characteristic Key field or just another normal field in the Master data Table.

In the Business Explorer tab, no changes to be done.  

Page 6: lsmw tutorials

Save + Activate => P tables gets created

In the Master data/texts tab,

-          Check “With Master data”, to create a Master Data table, having naming convention /BIC/P<characteristic name>

-          Check “With Texts”, to create a corresponding Text table for this Master Data table with two default fields – Language & Description.

Select ‘short/medium/long texts’, also ‘texts language dependent’.

-          Select “Char is InfoProvider” (as our InfoObject is our target in this scenario).

-          Enter the InfoArea in the box below.

In the Attribute tab, enter the fields (non-key fields) that need to be maintained within the Master Data table.

Ex: Customer Id – primary key field

Page 7: lsmw tutorials

Land

City  

On entry of each field, hit [Enter] and in the pop-up box, select the 1st option – “Create Attribute as Characteristic”.

Page 8: lsmw tutorials

Enter the Data type and the Length. [Enter]

Repeat the same for other fields too.  

[Activate ] - Activate all dependent InfoObjects.  

Create File Interface: Source Systems à File à Createà <New File System>

Or

Use the existing file source system

Page 9: lsmw tutorials

Data Source creation/selection:  

On the Navigator tab, select Data Source. Click on the ‘[X]’ button to Choose the Source System.  

Choose the Source System à File à <Flat File source system name>  

Page 10: lsmw tutorials

Right click on the header and Create Application Component.  

 

Enter the name and description for Application Component.

Ex: Name: APC_CUSTOMER

Click ok.

The technical name of Application component APC_CUSTOMER now gets saved as => ZAPC_CUSTOMER  

Right click on the Application component and create DataSource  

Page 11: lsmw tutorials

 

Enter a suitable DataSource name : DS_Cust

Source System : Flatfile

Select Data Type of DataSource : Master Data attributes à as we are creating master data table.  

Note:

Select Master Data Attributes, while you are uploading Master Data from file (DS1)

Select Master Data Text, while you are uploading Text Descriptions for the Master Data records (DS2)

 

Page 12: lsmw tutorials

In the right Window, you can view the Data Source properties.

General Info tab – provides information on the Data Source created  

Extraction tab – provides details of file to be extracted.

In a Data source, we need to mention 2 details:

-          Name of Flat File (ASCII or CSV) to be uploaded

-          Structure (Layout) of the input file, mentioning the fields.  

Therefore, make the following changes:

- Select name of file using F4, search for the file on you local desktop

- Header rows to be ignored = ‘1’ (if file has a header row as column titles)

= ‘0’ (if file has no header row)

- Select Data Format as – “Separated with Separator (for ex CSV)”.

Enter the Data Separator as ‘ , ‘.  

Page 13: lsmw tutorials

Proposal tab – provides a quick view of the data in the flat file to be uploaded

Click on the ‘Load Example’ tab. The details can be viewed in the below pane.  

Fields tab – provides details of all fields used to create a data structure, to map with the fields from Source file.

-          In the Template Info field, enter the field names (characteristics/attributes).

-          [Enter] or [Save]

-          [Copy] : all properties of the characteristics ( ex: data types, length etc) are copied here.  

Note: the fields 0LANGU and 0TXTSH are the standard SAP defined characteristics InfoObjects.  

[Save]

[Activate]  

Page 14: lsmw tutorials

 

Preview tab – gives a preview of data on flat file loaded onto a structure.

-          Click on “Read Preview Data”  

Info Package: An InfoPackage helps to transport data from the Data Source structures into the PSA tables. (This is similar to transfer of data from Work areas to Internal Tables in R/3 ABAP).  

Rt. Click on the Data Source and Create InfoPackage.  

Page 15: lsmw tutorials

Enter the InfoPackage name : IP_Cust

Enter a suitable Description  

Select the corresponding DataSource from the list below and [Save].  

 

On the right window, we have the InfoPackage properties:

Data Selection tab – to initiate loading of data into the infopackage

-          Select “Start Data Load Immediately”

-          Click on [Start].

-          Then click on the [Monitor]button – next to “Process Chain Mgmt”

Or [ F6].  

In the next screen, we can view the status of the data loading to PSA.

Click on the [PSA Maintenance] or [Ctrl + F8] to maintain the PSA table with the flat file values.  

Page 16: lsmw tutorials

 

In the pop-up, defining the number of records per request, click OK.  

 

This leads to the PSA display screen, with the table and the respective data in them.

Click on [Back] and come back to the DataSource screen.  

Transformation: This is a rule that is defined, for mapping the source fields in the DataSource to the final Target (basically, the Info Providers from where BI extracts the reports).

In this case, our target is the InfoObject (Master data table), which has been already created.  

Note: Normally, the Transformation can be created on the Data Source or the Target. Here, we are creating a Transformation on the DataSource.  

Right click on DataSource à Create Transformation  

Page 17: lsmw tutorials

In the pop-up,

For the Target of Transformation,

- Enter Object Type: InfoObject (this is our target in this scenario)

- Enter subtype of Object: Attributes (as we’re considering Master data only. Not transactional data)

- Enter the name of the InfoObject we created.  

For the Source of Transformation,

- Enter Object Type: DataSource (this is our source structure)

- Enter name of Data Source used

- Enter the Source System used.

Click on OK  

Note:

While uploading Master Data, select Sub-type of Object : ‘Attributes’ (IP1 for DS1)

While uploading Text desc. For this Master Data, select Subtype of Object : ‘Texts’ (IP2 for DS2)

Page 18: lsmw tutorials

In the next screen pop-up, we get the no. of proposals (rules) generated to map source fields with target fields. Click on Ok.  

 

On the next window we can see a graphical representation of the mapping of Source fields to Target fields.  

Save and Activate, if the mapping if done correctly.

Data Transfer Process (DTP):

The DTP is a process used to transfer data from the PSA tables, into the data Targets, based on the Transformation (mapping) rules.  

DataSource à right click à Create Data Transfer Process.

Page 19: lsmw tutorials

In the pop-up,

-          The DTP name is described as : < DataSrc/SourceSys -> InfoObject >

-          DTP type : standard

-          Target of DTP : Object Type : InfoObject (in this case)

Subtype of Object : Attribute

Name : < name of InfoObject >

-          Source of DTP: Object Type : Data Source

DataSource : <name>

Source System: Flat file

Click on OK.  

In the DTP properties window,

Page 20: lsmw tutorials

Extraction tab,

- Select Extraction Mode as ‘Full’.

[Save]

[Activate]

Update tab – no changes to be made  

Execute tab,

- Click on [Execute] button  

 

Page 21: lsmw tutorials

 

Click on [Refresh] until the icons in Yellow, turn Green.

Incase a Red icon appears, we need to track the error and rectify it.

Go Back.  

To view the contents of the Target (Info Object), there are 2 ways:

1. Go to the InfoObject – CUSTNO à MasterData/Texts tab à Dbl click on the Master data table created : /BIC/P<Char name> à Table display à Execute  

Page 22: lsmw tutorials

On Transformation/DTP à Attribute à rt.click à Manage à rt windw Contents tab à [Contents] à F8.

 

Text table Data Display is Language Dependent:

For Lang = ‘EN’, display corresponding Short Desc.  

 

For Lang = ‘DE’, display corresponding Short Desc.

Page 23: lsmw tutorials

 

Observations:

In the above Master data table display,

The fields – Customer Name, Customer Land, Customer City : have been created and loaded with data as per the file.

These 3 fields have been created as a result of checking the “With Master data” for the Characteristic. The contents of the Master data are stored in the newly created transparent table /BIC/P<char. Name> Ex:

 

The fields – Language , Description : have been created and loaded with data as per the file.

These 2 fields have been created by default, as a result of checking the “With Text data” for the Characteristic. The contents of the Text data are stored in the newly created transparent table /BIC/T<char. Name> Ex: