Академический Документы
Профессиональный Документы
Культура Документы
SAP BI Backend
Functionality Using
ABAP
Marc F. Bernard
SAP
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
Appendix
© SAP AG 2005, 2
What This Session Will Cover
5) Process Chains
Focus is on
SAP BI Backend
3) BEx Variables
4) Virtual
InfoCubes, Key
Figures, and
Characteristics
2) Data Staging
1) Data Extraction
© SAP AG 2005, 3
ABAP Basics – What You Should Know
ABAP
ABAP Performance
Performance
ABAP
ABAP Enhancements
Enhancements
© SAP AG 2005, 4
ABAP Performance
Internal Tables
Know the difference between standard, sorted, and hashed tables
Understand when to use which table type for best performance
Field Symbols
Avoid field symbols if data can be accessed directly
Use field symbols to accelerate table operations (read, update)
Subroutines
Define the correct parameter types for subroutines and function modules
(using, changing, importing, exporting)
Use global variables only when necessary
Data Retrieval
Reduce database accesses as much as possible
Set table buffering correctly (none, single record, generic)
Check if secondary indexes will speed up database selections
© SAP AG 2005, 5
ABAP Basics – What You Should Know
ABAP
ABAP Performance
Performance
ABAP
ABAP Enhancements
Enhancements
© SAP AG 2005, 6
ABAP Enhancements: How They Work
***
*** SAP
SAP program
program ***
***
*********************************
*********************************
PROGRAM
PROGRAM <name
<name of
of SAP
SAP program>.
program>.
<Call enhancement>
<Object in customer namespace>
© SAP AG 2005, 7
Function Module Exit: Process Flow
Application Program
X Function Group
CALL CUSTOMER-FUNCTION
Include in
Customer Namespace
© SAP AG 2005, 8
Calling and Creating Function Modules
PROGRAM
PROGRAM <program_name>.
<program_name>.
START-OF-SELECTION.
START-OF-SELECTION.
...
...
INCLUDE zxaaau01.
ENDFUNCTION.
ENDFUNCTION.
© SAP AG 2005, 9
Implementing Business Add-Ins: Initial Screen
Name of the
Implementation name <impl>
Implementation
Display Change Create
Create
© SAP AG 2005, 10
Implementing Business Add-Ins: Methods
Methode Description
<method> Add-in method
METHOD if_<badi-interface>~<method>.
*...
ENDMETHOD.
© SAP AG 2005, 11
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
Appendix
© SAP AG 2005, 12
Data Extraction
Contents:
Creating generic DataSources using function modules for
Data Extraction
© SAP AG 2005, 13
Using the Tools for Generic Data Extraction
© SAP AG 2005, 14
Tools for Generic Data Extraction: RSO2
DataSources for
•Transaction data
• Master data attributes
• Texts
© SAP AG 2005, 15
Creating DataSources for Generic Data Extraction
© SAP AG 2005, 16
Generic Data Extraction with Function Modules:
Function Module Interface
© SAP AG 2005, 17
Process of Extraction
1. Initialization call:
Only the request parameters are transferred from the module
here. It cannot transfer data at this point.
2. First read call:
The extractor delivers the data typed with the extraction structure
to an interface table.The number of rows expected is specified in a
request parameter (I_MAXSIZE).
3. Further read calls:
The extractor delivers the data connected to the last package,
again in a package with I_MAXSIZE rows.
4. Last call:
The function module is now called until the exception
NO_MORE_DATA is produced. No more data can be transferred
in the call in which the exception is produced.
© SAP AG 2005, 18
Enhancing Business Content DataSources
Reasons:
You want to add extra attributes to the characteristics (master data)
shipped with the system
You want to populate additional fields that you appended to the
extract structure with data at the time of extraction
You want to change/enhance texts or hierachies
Prerequisites:
The additional data is available at the time the extraction takes place
All information that is needed to determine the additional data clearly
is available
© SAP AG 2005, 19
Creating and Maintaining Customer Appends
In BW-IMG
(TA SBIW)
© SAP AG 2005, 20
Developing Service API Function Enhancements
In BW-IMG 1
(TA SBIW)
© SAP AG 2005, 21
Important Points/Troubleshooting
Important points
Once the function exit has been used, it is called for every
extraction (CASE statement required)
Key fields for enhanced content must be available
Maximum field length is 60 characters
Include all recommended units
Further documentation is available under CMOD transaction
© SAP AG 2005, 22
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
Appendix
© SAP AG 2005, 23
Data Staging (1)
Overview
Overview
InfoPackages
InfoPackages
Start
Start Routines
Routines
Transfer
Transfer Rules
Rules
Update
Update Rules
Rules
© SAP AG 2005, 24
SAP BI Data Staging and ABAP Routines
Info Provider
• Start routine
ABAP • Update rule
Communication Structure
• Start routine
Data Flow
ABAP • Transfer rule
Transfer Structure
InfoPackage
© SAP AG 2005, 25
Sequential Order to Work with SAP BI Structures
The BW ABAP routines are processed sequentially for all records and
all fields:
InfoPackage – Create dynamic filenames (for flat file import)
Transfer rule – Dynamic routines to combine field by field from the transfer structure to
the communication structure
Update rule – Dynamic routines to combine field by field from the communication struture
to the infoprovider key figures or to the ODS-object data fields
Update rule – Dynamic routines to combine field by field from the communication
structure to the infoprovider characteristics or the ODS-object key fields
© SAP AG 2005, 26
Data Staging (2)
Overview
Overview
InfoPackages
InfoPackages
Start
Start Routines
Routines
Transfer
Transfer Rules
Rules
Update
Update Rules
Rules
© SAP AG 2005, 27
Selection Possibilities
DYNAMIC
© SAP AG 2005, 29
Deletion of Requests After the Update Rules Where
Executed
Important:
The deletion functionalities are
executed after all update rules
have run!
© SAP AG 2005, 30
Dynamic Determination of Filenames
© SAP AG 2005, 31
Data Staging (3)
Overview
Overview
InfoPackages
InfoPackages
Start
Start Routines
Routines
Transfer
Transfer Rules
Rules
Update
Update Rules
Rules
© SAP AG 2005, 32
Call of Start Routines
© SAP AG 2005, 33
Classic Usage – Transfer Rules
© SAP AG 2005, 34
Typical Scenarios – Update Rules
Consolidation scenarios:
Consolidate characteristic and key figure combinations
Key figure calculation to store the result on the database in order to
release the OLAP processor, e.g., when multiple basis cubes are
consolidated into one
© SAP AG 2005, 35
Data Staging (4)
Overview
Overview
InfoPackages
InfoPackages
Start
Start Routines
Routines
Transfer
Transfer Rules
Rules
Update
Update Rules
Rules
© SAP AG 2005, 36
Call of Transfer Rule Routine
1.
2.
3.
Create routine
Overview
Overview
InfoPackages
InfoPackages
Start
Start Routines
Routines
Transfer
Transfer Rules
Rules
Update
Update Rules
Rules
© SAP AG 2005, 38
InfoCube Characteristic Update Rule
ODS-Object Key Field Update Rule
Interface:
Like in the start routine global declaration within the header
The form routine “compute_key_field” delivers the following parameters:
The table MONITOR for monitoring
The communication structure COMM_STRUCTURE with all fields from the data
source
The current record number of the loop over the data package
The number of total records
RESULT delivers to the marked characteristic the result value
RETURNCODE says whether the current record will be processed or not
ABORT clarifies whether the whole data package will be processed or not
© SAP AG 2005, 39
Time References
Within update rules there are various
possibilities to reference time
dependencies:
Characteristic update rule with time
reference
It is possible to update data target
characteristics of type “DATE“ via an
automatic time distribution
The field is fed from a data field out of the
communication structure
For example, the data target characteristic
calendar day is fed from the source
characteristic calendar month
The effect is that every summarized key
figure has to be distributed to the calendar
days of the month
In addition to that, it can be defined
whether the company calendar has to be
used
Time characteristics
Within the frame time reference various
data target time characteristics can be filled
automatically from only one time
characteristic of the data source
© SAP AG 2005, 40
Speciality: Return Table
© SAP AG 2005, 41
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
Appendix
© SAP AG 2005, 42
BEx-Variables
© SAP AG 2005, 43
BEx-Variables (cont.)
Default information:
For filling variables the standard SAP Enhancement
RSR00001 is used
See the documentation related to this enhancement
for details and example coding (transaction SMOD)
In the function module of this enhancement you will
find include ZXRSRU01 where you implement your
program code
The exit is called four times, called "steps" (I_STEP)
© SAP AG 2005, 44
BEx-Variables (cont.)
Default information:
Step 1 (I_STEP = 1) is called before the processing of the
variable pop-up and gets called for every variable of the
processing type, “customer exit.” You can use this step
to fill your variable with a default or proposal value
Step 2 (I_STEP = 2) is called after processing of the
variable pop-up. This step is called only for those
variables that are not marked as “ready for input” and
are set to “mandatory variable entry”
Step 3 (I_STEP = 3) is called after all variable processing
and gets called only once and not per variable. Here you
can validate the user entries
Step 0 (I_STEP = 0) is called for variables that are used in
authorizations objects
© SAP AG 2005, 45
BEx-Variables (cont.)
Please note that you cannot overwrite the user input values
into a variable with this customer exit. You can only derive
values for other variables or validate the user entries
© SAP AG 2005, 46
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
Appendix
© SAP AG 2005, 47
Business Scenario
© SAP AG 2005, 48
What Is a Virtual Characteristic or Key Figure?
Historical Background:
© SAP AG 2005, 49
Virtual Key Figures and Characteristics
Three
Three Implementation
Implementation Steps:
Steps:
1)
1) Creating
Creating aa BAdI
BAdI Implementation
Implementation
2)
2) Implementation
Implementation of
of the
the DEFINE
DEFINE Method
Method
3)
3) Implementation
Implementation of
of the
the COMPUTE
COMPUTE Method
Method
© SAP AG 2005, 50
Virtual InfoCubes with Services
Definition:
InfoCube that does not have its own physical data storage in SAP BI
Usage:
You use a Virtual InfoCube with services if you want to display data
from non-SAP BI data sources in SAP BI without having to copy the
data set into the SAP BI structures
The data can be either local or remote. You can also use your
own calculations to change the data before it is passed to the
OLAP processor
© SAP AG 2005, 51
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
Appendix
© SAP AG 2005, 52
ABAP in Process Chains
Process
Process Chains
Chains
Insert
Insert Process
Process "ABAP
"ABAP Program"
Program"
Implementing
Implementing New
New Process
Process Types
Types
© SAP AG 2005, 53
Process Chains Maintenance in RSPC
© SAP AG 2005, 54
ABAP in Process Chains
Process
Process Chains
Chains
Insert
Insert Process
Process "ABAP
"ABAP Program"
Program"
Implementing
Implementing New
New Process
Process Types
Types
© SAP AG 2005, 55
Insert ABAP Program
1.
2.
© SAP AG 2005, 56
Create Variant
1.
2.
© SAP AG 2005, 57
Maintain Variant – Program to Call/Called From
Programs with or
without variants
© SAP AG 2005, 58
ABAP in Process Chains
Process
Process Chains
Chains
Insert
Insert Process
Process "ABAP
"ABAP Program"
Program"
Implementing
Implementing New
New Process
Process Types
Types
© SAP AG 2005, 59
Implementing a New Process Type
If you ...
... then you can use the process type "ABAP" to run your program in a chain
© SAP AG 2005, 60
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
Appendix
© SAP AG 2005, 61
7 Key Points to Take Home
© SAP AG 2005, 62
For More Information: Access the SAP Developer Network
– www.sdn.sap.com
The central hub for the SAP technology
community
Everyone can connect, contribute, and
collaborate – consultants, administrators
and developers
Focus around SAP NetWeaver and SAP
xApps
© SAP AG 2005, 63
Questions?
Q&A
Marc.bernard@sap.com
© SAP AG 2005, 64
Agenda
Introduction
1) Data Extraction
2) Data Staging
3) BEx Variables
4) Virtual InfoCubes, Key Figures, and Characteristics
5) ABAP in Process Chains
Summary
© SAP AG 2005, 65
SAP Enhancements and BAdIs
RS_BBS_BADI:
Exit of Report-Report-Interface
RSDBC_SQL_STATEMENT:
DB connect: BADIs for the DB SQL Statements
RSR_OLAP_AUTH_GEN:
Generating authority: Creating User (new in rel. 3.10)
RSR_OLAP_BADI:
Virtual characteristics and key figures in reporting
RSU5_SAPI_BADI:
SAP BI Service APIs (in BW and in R/3 since 4.6, respectively)
© SAP AG 2005, 66
SAP Enhancements and BAdIs (cont.)
OPENHUB_TRANSFORM:
Open hub transformations
RSRA_ALERT:
Batch reporting (BW-BEX-RSRB)
RSAR_CONNECTOR:
Formula Builder—customer-defined functions
BW_SCHEDULER:
BAdI for subsequent processing
RSOD_DOC_BADI:
BAdI for documents
© SAP AG 2005, 67
SAP Enhancements and BAdIs (cont.)
RSOD_ITEM_DOC:
BAdI for the Web item “Single Document”
RSOD_ITEM_DOC_LIST:
BAdI for the Web item “List of Documents”
RSOD_WWW_DOC_MAINT:
BAdI for the maintenance of text documents on the Web
© SAP AG 2005, 68
SAP Enhancements and BAdIs (cont.)
© SAP AG 2005, 69
Exits in Business Planning and Simulation (BW-BPS)
© SAP AG 2005, 70
Runtime Analysis of ABAP Statements
Documentation of
ABAP Statements
© SAP AG 2005, 71
Copyright 2005 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, R/3, mySAP, mySAP.com, xApps, xApp 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 the trademarks of their respective companies.
© SAP AG 2005, 72