Transformation rules for SAP BI

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

Summary
This article discusses about transformation and the various transformation rules Author(s): 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

..................1 Author Bio...bpx............................................................................................1 SAP BI NetWeaver 2004s..............................................................................4 Constants......................8 Related Content...........................com | BOC .............................................................................................................................................com | BPX .....................1 Summary....................................2 Transformations....................................................................com 2 ........com | UAC ...........................................................................................5 Routines.......................................................................sap.................................................................................1 Table of Contents........................................................3 Transformation rules........................................ For more information.............................................................................................................................................................................................................................................................................................................................sap........................................................................sap....................................3 How to define transformation rules........................................................................uac..........sap....................................................................sdn....................................................boc.................10 SAP COMMUNITY NETWORK © 2010 SAP AG SDN ....................................7 Initial.....9 Copyright.............................. visit the Business Intelligence homepage..4 Direct Assignment............................5 Reading Master Data.................................................................................................................................................................................................Transformation rules Table of Contents Applies to:..........................................................6 Formula.....................................................................................................................................................................................................................................................................................................................................................

when mapping fields on the InfoSource to the fields in the InfoCubes.com | UAC . A good example is VAT.boc.bpx.the mapping was always one to one.e you have a field in the source table that maps directly to the destination. Sometimes.sap. It is also possible that the fields are not matched up correctly. In real time.uac.com | BPX .sap. the mapping is one-to-one i.com | BOC .Transformation rules Transformations Transformation is all about mapping fields from source systems to destination databases. For example.com 3 . this is not always the case. length of the fields might be different in both or the way figures are calculated might also be different. Some InfoObjects are not present in the InfoSource fields but have to be calculated. Transformation rules are used to perform these operations. The amount of value-added tax charged differs from country to country and this needs to be transformed (recalculated). There are 6 different types of tranformations.sdn. Transformation rules Normally. These calculations are done through transformations.sap. • • • • • • Direct assignment Constants Reading master data Routines Formula Initial SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sap.

sap. material number will be transformed using direct assignment.Transformation rules 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 Direct Assignment This will copy the value in the source field directly into the target field.com | BOC .sap.bpx. By default all the SAP COMMUNITY NETWORK © 2010 SAP AG SDN .boc.uac.com | BPX .com 4 .sdn.sap.sap.com | UAC . For example the customer number.

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. SAP COMMUNITY NETWORK © 2010 SAP AG SDN . The Financial Management Area characteristic is included in the target but does not exist in the source as a characteristic. the source contains a characteristic (cost center. you have to use routines. integer. you can assign a source InfoObject of the same type (amount. It is not possible to read recursively. 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. time) or you can create a routine. you have to translate the source currency into the target currency using a currency translation. you have to execute the change run.com | BOC . you have to convert the source unit of measure into the target unit of measure using a unit of measure conversion. Constants This transformation rule will fill the target field with a specified value. number. If the attribute is time dependent. for example) that has the Financial Management Area characteristic as an attribute. If the system does not propose a source InfoObject. The field is filled directly from the selected source InfoObject. However.sap. it is filled directly with the value specified. The attributes and their values are read using the key and are then returned.sap. If you assign a source InfoObject to a target InfoObject that has the same type but a different currency. All the records will have the same value specified in the constant.com | BPX .uac. the import data field can be filled with today’s date.Transformation rules transformations are in the direct assignment rule. For example. By reading the master data.sdn. or apply the unit of measure from the source.bpx. that is.com 5 . The field is not filled by the InfoObject.sap. or apply the source currency. If this is not available.sap.boc. If you assign a source InfoObject to a target InfoObject that has the same type but a different unit of measure. To do this. an error occurs. quantity. If you have changed master data. to read additional attributes for the attribute. the active version is read. float.com | UAC .

com | UAC . or only for the attributes displayed. Routines are mostly written by ABAP consultants.Transformation rules you also have to define when it should be read: at the current date (sy-date). for the same characteristic.bpx. at the beginning or end of a period (defined by a time characteristic in the InfoSource). If. The system allows you to select whether the routine is to be valid for all attributes for this characteristic. for example they can be used to convert the amount to another currency.sap.sap. end routines and expert routine Start routines are used to pre process the data before transformation. This can be used for integrity checks etc. If you select Return Table.com 6 . or at a constant date that you enter directly. you can delete these from the start routine. you generate different rules for different SAP COMMUNITY NETWORK © 2010 SAP AG SDN .sap. If you do not want to update specific records.uac. There are start routines.sdn.boc. the corresponding key figure routine no longer has a return value. The field is filled by the transformation routine you have written. 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. Read customer name from master table from customer number where customer name (WP_CNM) is an attribute of customer number (WP_CNO). 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.sap. Sy-date is used as the default.com | BPX . Transformation rules generally only have one return value. Routines Routines are special code written to handle complex cases.com | BOC .

sap. This means that automatic calculation is not possible.com | BPX . The return parameter 'UNIT' is then also added to the routine. date-week. For more information. replace.sap. If you fill the target key figure from a transformation routine. SAP COMMUNITY NETWORK © 2010 SAP AG SDN .com | BOC .sap. With InfoCubes: You can also select Routine with Unit.sdn. into tons in the target. to convert the unit KG in the source. date routines like DATECONV.com 7 .Transformation rules key figures or data fields. r_trim. add_to_date. You can use this option.uac. such as 'ST'. Major function available in the formula editor are Concatenate.com | UAC . and. a separate data record can be created for each key figure from a data record of the source. left/right (n characters). sub string. Formula The InfoObject is updated with a value determined using a formula. see Transformation Library and Formula Builder. You can store the required unit of the key figure. for example. condense. in this parameter. date_diff. logical functions like if. currency translation has to be performed using the transformation routine.1_trim.sap.bpx.boc.

sap.com | BOC .sap.com 8 .Transformation rules Initial The field is not filled.sap.sap. SAP COMMUNITY NETWORK © 2010 SAP AG SDN .bpx.com | BPX .sdn.com | UAC .boc.uac. It remains empty for all the records.

com | UAC .sap.sap.Transformation rules Related Content Transformation Rule Type SAP BI Training : Transformation rules Problem with transformation rules for master data reading SAP COMMUNITY NETWORK © 2010 SAP AG SDN .com 9 .bpx.sap.boc.uac.com | BPX .sdn.sap.com | BOC .

GPFS. JavaScript is a registered trademark of Sun Microsystems. HACMP. z/VM. Inc. BatchPipes. Redbooks. Windows. XML. z9. POWER5. if any. These materials are subject to change without notice. zSeries. AIX. Outlook. PowerVM. World Wide Web Consortium.. Program Neighborhood. without representation or warranty of any kind. RACF. z10. Adobe. Data contained in this document serves informational purposes only. RETAIN. PostScript. MetaFrame. Inc. Inc. System z10. SAP NetWeaver.com | UAC . and MultiWin are trademarks or registered trademarks of Citrix Systems. Java is a registered trademark of Sun Microsystems. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services.uac. Linux is the registered trademark of Linus Torvalds in the U. and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies. pSeries. and PowerPoint are registered trademarks of Microsoft Corporation. iSeries. and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.com 10 . SAP. Duet. HTML. Crystal Reports. Power Architecture.S. IBM. Oracle is a registered trademark of Oracle Corporation. VideoFrame. National product specifications may vary.sdn.sap. AS/400. System i. POWER6. System p5. R/3. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. DB2 Connect. WinFrame. System p. DB2 Universal Database. Nothing herein should be construed as constituting an additional warranty. Excel. MVS/ESA. DB2. SAP Business ByDesign. System Storage. System z. OS/2.bpx.sap. Citrix. S/390 Parallel Enterprise Server. OSF/1. PartnerEdge. All rights reserved. S/390.sap. PowerPC. Intelligent Miner.com | BOC . Xcelsius.com | BPX . Business Objects and the Business Objects logo. and SAP Group shall not be liable for errors or omissions with respect to the materials. POWER6+. Crystal Decisions. OS/390. and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. ICA. Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.A. X/Open. System z9. XHTML and W3C are trademarks or registered trademarks of W3C®. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only. Business Objects is an SAP company. Acrobat. z/OS. POWER5+. and other countries. ByDesign. used under license for technology invented and implemented by Netscape. i5/OS. Netfinity. BladeCenter. Microsoft.boc. Parallel Sysplex.Transformation rules Copyright © Copyright 2010 SAP AG. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. in the United States and in other countries. System i5. and Motif are registered trademarks of the Open Group. xSeries. System x. OS/400. the Adobe logo. OpenPower. BusinessObjects. WebSphere. UNIX.sap. POWER. The information contained herein may be changed without prior notice. SAP COMMUNITY NETWORK © 2010 SAP AG SDN . eServer. Web Intelligence. Massachusetts Institute of Technology.