Professional Documents
Culture Documents
Transformation Rules For SAP BI
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
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.
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
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
Right click on the field that needs rules and click on rule details
Select the rule type needed and give description for the rule
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.
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.
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.
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