Sei sulla pagina 1di 9

Transformation Rules for SAP BI

Applies to:
SAP BI NetWeaver 2004s. For more information, visit the EDW homepage.

Summary
This article discusses about transformation and the various transformation rules Author: Kiran Gasmar

Company: Applexus Software Solutions Created on: 24 December 2010

Author Bio
Kiran Gasmar is working as SAP BI Consultant with Applexus Software Solutions (P) Ltd. He has experience in SAP ABAP and SAP BI.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

Table of Contents
Transformations .................................................................................................................................................. 3 Transformation Rules ......................................................................................................................................... 3 How to Define Transformation Rules .................................................................................................................. 4 Direct Assignment ........................................................................................................................................... 5 Constants ........................................................................................................................................................ 5 Reading Master Data ...................................................................................................................................... 5 Routines .......................................................................................................................................................... 6 Formula ........................................................................................................................................................... 7 Initial. ............................................................................................................................................................... 7 Related Content .................................................................................................................................................. 8 Disclaimer and Liability Notice ............................................................................................................................ 9

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

Transformations
Transformation is all about mapping fields from source systems to destination databases. Sometimes, the mapping is one-to-one i.e you have a field in the source table that maps directly to the destination. It is also possible that the fields are not matched up correctly. For example, length of the fields might be different in both or the way figures are calculated might also be different. A good example is VAT. The amount of value-added tax charged differs from country to country and this needs to be transformed (recalculated). Transformation rules are used to perform these operations.

Transformation Rules
Normally, when mapping fields on the InfoSource to the fields in the InfoCubes,the mapping was always one to one. In real time, this is not always the case. Some InfoObjects are not present in the InfoSource fields but have to be calculated. These calculations are done through transformations. There are 6 different types of tranformations. Direct assignment Constants Reading master data Routines Formula Initial

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

How to Define Transformation Rules

Right click on the field that needs rules and click on rule details

Select the rule type needed and give description for the rule

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

Direct Assignment This will copy the value in the source field directly into the target field. For example the customer number, material number will be transformed using direct assignment. By default all the transformations are in the direct assignment rule. The field is filled directly from the selected source InfoObject. If the system does not propose a source InfoObject, you can assign a source InfoObject of the same type (amount, number, integer, quantity, float, time) or you can create a routine. If you assign a source InfoObject to a target InfoObject that has the same type but a different currency, you have to translate the source currency into the target currency using a currency translation, or apply the source currency. If you assign a source InfoObject to a target InfoObject that has the same type but a different unit of measure, you have to convert the source unit of measure into the target unit of measure using a unit of measure conversion, or apply the unit of measure from the source. Constants This transformation rule will fill the target field with a specified value. For example, the import data field can be filled with todays date. The field is not filled by the InfoObject; it is filled directly with the value specified. All the records will have the same value specified in the constant.

Reading Master Data The InfoObject is updated by reading the master data table of a characteristic that is included in the source with a key and a value and that contains the corresponding InfoObject as an attribute. The attributes and their values are read using the key and are then returned. The Financial Management Area characteristic is included in the target but does not exist in the source as a characteristic. However, the source contains a characteristic (cost center, for example) that has the Financial Management Area characteristic as an attribute. You can read the Financial Management Area attribute from the master data table and use it to fill the Financial Management Area characteristic in the target. It is not possible to read recursively, that is, to read additional attributes for the attribute. To do this, you have to use routines. If you have changed master data, you have to execute the change run. By reading the master data, the active version is read. If this is not available, an error occurs. If the attribute is time dependent, you also have to define when it should be read: at the current date (sy-date), at the beginning or end of a period (defined by a time characteristic in the InfoSource), or at a constant date that you enter directly. Sy-date is used as the default.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

Read customer name from master table from customer number where customer name (WP_CNM) is an attribute of customer number (WP_CNO). Routines Routines are special code written to handle complex cases. There are start routines, end routines and expert routine Start routines are used to pre process the data before transformation, for example they can be used to convert the amount to another currency. This makes the process efficient when there a lot of records being imported and a handful will be empty fields. End routines are used to post process the data on a package-by-package basis. This can be used for integrity checks etc. Routines are mostly written by ABAP consultants. The field is filled by the transformation routine you have written. The system allows you to select whether the routine is to be valid for all attributes for this characteristic, or only for the attributes displayed. Transformation rules generally only have one return value. If you select Return Table, the corresponding key figure routine no longer has a return value; it has a return table. You can then generate any number of values from a data record. For DataStore objects and InfoObjects: you cannot use the return code in the routine for data fields that are updated by being overwritten. If you do not want to update specific records, you can delete these from the start routine. If, for the same characteristic, you generate different rules for different key figures or data fields, a separate data record can be created for each key figure from a data record of the source. With InfoCubes: You can also select Routine with Unit. The return parameter 'UNIT' is then also added to the routine. You can store the required unit of the key figure, such as 'ST', in this parameter. You can use this option, for example, to convert the unit KG in the source, into tons in the target. If you fill the target key figure from a transformation routine, currency translation has to be performed using the transformation routine. This means that automatic calculation is not possible.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

Formula The InfoObject is updated with a value determined using a formula. For more information, see Transformation Library and Formula Builder. Major function available in the formula editor are Concatenate, sub string, condense, left/right (n characters),1_trim, r_trim, replace, date routines like DATECONV, dateweek, add_to_date, date_diff, logical functions like if, and.

Initial The field is not filled. It remains empty for all the records.

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

Related Content
Transformation Rule Type SAP BI Training : Transformation rules Problem with transformation rules for master data reading Rule Type SAP BI Training For more information, visit the EDW homepage

SAP COMMUNITY NETWORK 2010 SAP AG

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

Transformation Rules for SAP BI

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 2010 SAP AG

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

Potrebbero piacerti anche