Você está na página 1de 29

Advanced BW Data

Transformation

Gary Nolan
Platinum Consultant, SAP America Inc.
Agenda

The following topics will be discussed:

! Methods used for transformation of data in BW


! Referential Integrity Checking
! Time Distribution in Update Rules
! Master Data Conversion Routines
! Update/Transfer Routines
! Startroutine Validation and filtering
! Return Tables
! Advanced Transformation in Userexits
! Use of BADIs

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Referential Integrity Checking

!Allows checking of characteristics values against existing


master data

!In the past the integrity checking caused processing to stop

!It is now possible to:


! Control individual characteristic checking
! Validate against a master data table
! Provide specific error message
! Continue processing or stop processing

!Erroneous records are split into second request

!Checking is setup on communication structure

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Referential Integrity Checking – Comm. Structure

Integrity Checking
on Communication
Structure

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Referential Integrity Checking

Package set to turn red if


integrity check fails…it
could be set to green

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


InfoObject ODS Referential Integrity Checking

!It is also possible to validate against an ODS object


! Setup in the InfoObject Maintenance Screen
! Validates data based on what appears in the ODS
! Useful to validate entries on load against existing transactional values

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Time Distribution in Update Rules

!Time characteristics in update rules can be updated with a time


characteristic smaller than the source (as of BW version 3.x)
! For example: Data comes in from legacy file as monthly data,
however we would like to report on it weekly.
! InfoSource contains 0CALMONTH but not 0CALWEEK
! Time distribution allows the key figure data to be equally distributed
to weeks.
! Calendar Month 10/2003 would be distributed to weeks 40/2003, 41/2003,
42/2003, 43/2003, and 44/2003
! System takes percentage of number of days in month, i.e. 1/31 of key
figure value for each associated date

!Allows data to be “automatically” pro-rated to smaller time


periods upon load into an InfoCube

!Available with factory calendar or standard SAP calendars

!Must be used across all key figures not for one key figure

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Time Distribution
InfoSource
0CALMONTH
Associated with all data

Update Rules
Time Split via
Time Distribution

System takes 2/30 of


each key figure value
for week 44
7/30 for week 45
7/30 for week 46
7/30 for week 47
7/30 for week 48

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Master Data Conversion Routines

!Routine is added on InfoObject

!Code is in effect for all InfoSources containing this InfoObject

!Allows for global conversion/validation of master data

!Routines can also be added to master data transfer rules,


however, they would have to be added to all transfer rules using
this master data attribute

!Examples:
! Check integrity of incoming data from flat file
! Validate data to a custom cross reference table because of
realignment
! Validity checks

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Master Data Conversion Routines
Need to covert all incoming flat file data company codes from 4545 to 9999

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Update/Transfer Routines

!Most common way of transforming data

!Some transfer/update routines can be avoided using


transformation formulas

!Transfer routines can be added to update rules, transfer rules


and master data

!Allows for filtering, transformation

!Capability exists to skip a record if criteria is met by setting


value
! RETURNCODE NE 0

!Capability exists to Abort package if criteria is met


! ABORT = 0

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Debugging Update/Transfer Routines
● Debugging and tuning Update and Transfer rules:
■ Allows ABAP single step using break-points to determine
bottlenecks

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Startroutine Validation and Filtering

!Used to validate records in update rule or transfer rule

!Transactional Data or Master Data

!Data can be validated against any existing master data, ODS,


InfoCube, or custom z-table in BW using ABAP

!There are several advantages to putting filters in the startroutine


rather than in the update or transfer rule characteristic routines:
! All routines can be in one place
! If an outside table needs to be validated, it is only accessed once
rather than for each extracted record

!Records can be removed if they do not meet criteria

!ABAP – delete data_package where …….

!Data can also be altered in startroutine

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Startroutine Filtering

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Startroutine Results in Monitor

Startroutine filter
reduced the 500
transferred records
to 3 records

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Debugging Startroutines
● Debugging and tuning Startroutines:
■ Allows ABAP single step using break-points to determine
bottlenecks

Uses same tool as debugging transfer rules/update rules

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Return Tables

!Return Tables: Allow the ability to create multiple records from


one record
! BW is designed to aggregate data
! Without the concept of return tables, this would be very difficult, as
BW does not easily split records or create several records from one
record

!Works with ODS and InfoCube


!Return tables can exist on more than one key figure
!For example: Adding actual data and forecasted data in one
InfoCube from two sources
! Issue: There are multiple plan weeks for each actual calendar week
! The result cube should contain actual and plan data for comparison
! The plan data previously exists – when the actual occurs, it should
be written to each planned record – this would require multiple
records

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Return Tables – Combine Actual and Planned
Planned Sales
Plan Week Cal Week Material Plan Qty
Actual Sales 4/2003 7/2003 ABC 100
Cal Week Material Sales Qty 5/2003 7/2003 ABC 110
7/2003 ABC 100 6/2003 7/2003 ABC 90
8/2003 ABC 120 4/2003 8/2003 ABC 120
9/2003 ABC 110 5/2003 8/2003 ABC 110

InfoCube Actual vs. Planned Sales


Using Return
Plan Week Cal Week Material Plan Qty Actual Qty tables
4/2003 7/2003 ABC 100 100 the actual data
is paired with its
5/2003 7/2003 ABC 110 100 associated
6/2003 7/2003 ABC 90 100 planned sales in
the InfoCube or
4/2003 8/2003 ABC 120 120 ODS
5/2003 8/2003 ABC 110 120
… … … … …
 SAP AG 2003, Advanced Data Transformation – Gary Nolan
Return Tables – How to do it…

!A startroutine on the InfoCube update rules is needed to get the all


planned data and store it into an internal table
! Storing the associated planned data in an internal table allows this to be used
later in the update rule return table to merge the planned data with the actual
data
! This data could be read from an associated InfoCube or ODS

!Return table checkbox should be chosen in the key figure tab of the
update rules

!Code should be written to loop through the existing forecast data and
append records to RESULT_TABLE
! Each records written to RESULT_TABLE appends another record to the
InfoCube

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Return Tables – Steps in update rules to InfoCube

Create ABAP Add ABAP code


startroutine in routine to append
update rules to Check flag on the
to the
read all planned desired key figure
RESULT_TABLE
data from ‘Return Table’
the desired new
ODS/InfoCube records, reading
into internal table from the internal
table created in
startroutine

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Startroutine select into internal table

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Return Table ABAP Code

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Return Tables – Combined Actual and Planned
Planned Sales
Plan Week Cal Week Material Plan Qty
Actual Sales 4/2003 7/2003 ABC 100
Cal Week Material Sales Qty 5/2003 7/2003 ABC 110
7/2003 ABC 100 6/2003 7/2003 ABC 90
8/2003 ABC 120 4/2003 8/2003 ABC 120
9/2003 ABC 110 5/2003 8/2003 ABC 110

InfoCube Actual vs. Planned Sales


Using Return
Plan Week Cal Week Material Plan Qty Actual Qty tables
4/2003 7/2003 ABC 100 100 the actual data
is paired with its
5/2003 7/2003 ABC 110 100 associated
6/2003 7/2003 ABC 90 100 planned sales in
the InfoCube or
4/2003 8/2003 ABC 120 120 ODS
5/2003 8/2003 ABC 110 120
… … … … …
 SAP AG 2003, Advanced Data Transformation – Gary Nolan
Advanced Transformation in Userexit - RSAP0001

!Allows for the extension to fill custom appended fields in SAP


extractors
! Custom fields can be appended to existing extractors using
transaction RSA6
! These fields can be populated using RSAP0001
! This userexit is not designed to change key fields

!Code is typically added on the R/3 system, not the BW system

!Userexit can be used to fill/alter


! Transaction Data – component EXIT_SAPLRSAP_001
! Master Data - component EXIT_SAPLRSAP_002
! Text – component EXIT_SAPLRSAP_003
! Hierarchies - component EXIT_SAPLRSAP_004

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


CMOD Enhancement

Steps to Create an Enhancement

•Transaction: CMOD
•Create a Project

•Select Enhancement i.e. RSAP0001

•Choose Component i.e. EXIT_SAPLRSAP_001

•Double-click on include i.e. ZXRSAU01 within the Exit


•Add or change coding
•Activate the Project (Do not forget this step!)

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Debugging Userexit in transaction RSA3

RSAP0001 can be tested by setting a breakpoint in code


and using transaction RSA3 to test extraction
Allows for single step from breakpoints

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


BADIs (Business Add-ins)

!More flexible and reusable than customer enhancement


! Customer enhancements (CMOD/SMOD) may require code to be
rewritten for each country in a global implementation
! BADIs could be created with filter values to allow it to be dependent
on specific criteria

!Allow for SAP, customer, and partner (industry) solutions


! Easier to leverage functionality provided by others

!Allows all enhancements associated with a specific change to be


bundled into a single add-in
! Useful if there are several steps to the enhancement

!SAP provides some predefined BADIs in version 3.x

!More information can be found in help.sap.com

 SAP AG 2003, Advanced Data Transformation – Gary Nolan


Advanced BW Data
Transformation

Gary Nolan
Platinum Consultant, SAP America Inc.
gary.nolan@sap.com
Copyright 2003 SAP AG. All Rights Reserved

! No part of this publication may be reproduced or transmitted in any form or for any purpose without the express
permission of SAP AG. The information contained herein may be changed without prior notice.
! Some software products marketed by SAP AG and its distributors contain proprietary software components of other
software vendors.
! Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® are registered trademarks of
Microsoft Corporation.
! IBM®, DB2®, DB2 Universal Database, OS/2®, Parallel Sysplex®, MVS/ESA, AIX®, S/390®, AS/400®, OS/390®,
OS/400®, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere®, Netfinity®, Tivoli®,
Informix and Informix® Dynamic ServerTM are trademarks of IBM Corporation in USA and/or other countries.
! ORACLE® is a registered trademark of ORACLE Corporation.

! UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.

! Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®, VideoFrame®, MultiWin® and
other Citrix product names referenced herein are trademarks of Citrix Systems, Inc.
! HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide Web Consortium,
Massachusetts Institute of Technology.
! JAVA® is a registered trademark of Sun Microsystems, Inc.

! JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for technology invented
and implemented by Netscape.
! MarketSet and Enterprise Buyer are jointly owned trademarks of SAP AG and Commerce One.

! SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com 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 in several other
countries all over the world. All other product and service names mentioned are trademarks of their respective
companies.

 SAP AG 2003, Advanced Data Transformation – Gary Nolan

Você também pode gostar