This action might not be possible to undo. Are you sure you want to continue?
Marc F. Bernard
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
4 .ABAP Basics – What You Should Know ABAP Performance ABAP Performance ABAP Enhancements ABAP Enhancements © SAP AG 2005.
sorted. importing.ABAP Performance Internal Tables Know the difference between standard. changing. generic) Check if secondary indexes will speed up database selections © SAP AG 2005. 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. 5 . exporting) Use global variables only when necessary Data Retrieval Reduce database accesses as much as possible Set table buffering correctly (none. single record.
ABAP Basics – What You Should Know ABAP Performance ABAP Performance ABAP Enhancements ABAP Enhancements © SAP AG 2005. 6 .
<Call enhancement> <Object in customer namespace> Customer exit Business add-in Exit function module Method © SAP AG 2005.ABAP Enhancements: How They Work *** SAP program *** *** SAP program *** ********************************* ********************************* PROGRAM <name of SAP program>. 7 . PROGRAM <name of SAP program>.
8 .Function Module Exit: Process Flow Application Program X Function Group Exit function module EXIT_<prog_name>_001 CALL CUSTOMER-FUNCTION Include in Customer Namespace © SAP AG 2005.
... ENDFUNCTION. ..... START-OF-SELECTION.. ENDFUNCTION. FUNCTION-POOL XAAA. CALL CUSTOMER-FUNCTION '001' EXPORTING ... FUNCTION exit_<program_name>_001. PROGRAM <program_name>. . FUNCTION exit_<program_name>_001. . INCLUDE zxaaau01.... FUNCTION-POOL XAAA....Calling and Creating Function Modules PROGRAM <program_name>. © SAP AG 2005. .. START-OF-SELECTION. . 9 ... IMPORTING . .
Implementing Business Add-Ins: Initial Screen Business Add-Ins: Implementation Maint. Definition name <badi> © SAP AG 2005. Initial Screen Implementation name Display <impl> Name of the Implementation Create Change Create Business Add-Ins: Definition Sel. 10 .
. © SAP AG 2005.. Interface FCodes <badi-interface> <impl-class> Interface name Name of implementing class Methode <method> Description Add-in method Class Builder: Edit Method IF_<interface>~<m.> METHOD if_<badi-interface>~<method>... ENDMETHOD.Implementing Business Add-Ins: Methods Attrs. *. 11 .
Agenda Introduction 1) Data Extraction 2) Data Staging 3) BEx Variables 4) Virtual InfoCubes. and Characteristics 5) ABAP in Process Chains Summary Appendix © SAP AG 2005. Key Figures. 12 .
Data Extraction Contents: Creating generic DataSources using function modules for Data Extraction Enhancing DataSources for transaction data. master data attributes. 13 . and texts Using the Service API function enhancement to enrich data Overview of the options available for enhancing data in the source system © SAP AG 2005.
LIS) You use your own programs in the SAP system to populate your own tables You have to extract data from several DB tables when: Using a view is not possible because of insufficient JOIN Only some fields are relevant to these tables Data has to be enriched with information not available in the BW system © SAP AG 2005.. FI-SL. 14 ..Using the Tools for Generic Data Extraction When should you use the generic data extraction tools to create a DataSource? Business Content does not include a DataSource for your application You want to implement a delta method on your generic DataSource that cannot be implemented by using the generic delta functionality (timestamp.) The application does not allow you to create additional applicationspecific generic extractors (CO-PA. date .
15 .Tools for Generic Data Extraction: RSO2 DataSources for •Transaction data • Master data attributes • Texts © SAP AG 2005.
Creating DataSources for Generic Data Extraction © SAP AG 2005. 16 .
Generic Data Extraction with Function Modules: Function Module Interface © SAP AG 2005. 17 .
Initialization call: Only the request parameters are transferred from the module here. Last call: The function module is now called until the exception NO_MORE_DATA is produced. Further read calls: The extractor delivers the data connected to the last package. 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). No more data can be transferred in the call in which the exception is produced. again in a package with I_MAXSIZE rows. 3. 4. It cannot transfer data at this point. 2. 18 .Process of Extraction The function module is called up several times during an extraction process: 1. © SAP AG 2005.
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 .
20 .. ZABIW_MARA_S Append for BIW_MARA_S Component type DISMM © SAP AG 2005..Creating and Maintaining Customer Appends In BW-IMG (TA SBIW) 1 3 Dictionary: Change Append Structure 2 Append structure Short description Coponent ZZDISMM .
21 .Developing Service API Function Enhancements In BW-IMG (TA SBIW) 1 © SAP AG 2005.
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 Troubleshooting is easily done by setting a break-point in the exit code and starting the "Extractor Checker" tool (transaction RSA3) © SAP AG 2005. 22 .
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 Routines Start Routines Transfer Rules Transfer Rules Update Rules Update Rules
© SAP AG 2005, 24
SAP BI Data Staging and ABAP Routines
Info Provider • Start routine • Update rule Communication Structure ABAP • Start routine • Transfer rule Transfer Structure • Dynamic InfoPackage selection • Dynamic flatfile filename • Dynamic deletion of requests InfoPackage Data Flow
© SAP AG 2005, 25
n Transfer rule – Start routine Transfer rule – Dynamic routines to combine field by field from the transfer structure to the communication structure Update rule – Start routine 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 InfoPackage – Deletion or taking out of requests after the loading process: Only for non-collapsed requests Otherwise the request is cancelled if there is an exception aggregation Conditions of deletion in process chains are valid for all data targets of the InfoPackage. 26 ..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) InfoPackage – Dynamic selection – selection criteria 1 . within the scheduler the conditions are only valid for the selected data target © SAP AG 2005..
Data Staging (2) Overview Overview InfoPackages InfoPackages Start Routines Start Routines Transfer Rules Transfer Rules Update Rules Update Rules © SAP AG 2005. 27 .
of previous year) No date field: • Free boundary (also a period boundary is possible) All fields: • ABAP Routine © SAP AG 2005.Selection Possibilities InfoPackages provide static and dynamic selection criteria for every selection field for various characteristic types DYNAMIC Date field (due date is actual day): • Get yesterday (00:00 to 24:00h) • Get last week (Monday to Sunday) • Get last month (first to last day of last month) • Get last quarter (first to last day of last quarter) • Get last year (1st of Jan. to 31st of Dec. 28 • OLAP Variable .
there are no functions for deletion defined When a deletion function is defined the symbol appears © SAP AG 2005.Call of Deletion Functionality When the button on the InfoPackage tab “Data Targets” is grey. 29 .
30 .Deletion of Requests After the Update Rules Where Executed Important: The deletion functionalities are executed after all update rules have run! Multiple deletion conditions are possible at the same time: By object types By time definition By routine Exceptions to the deletion conditions can be set for specific days © SAP AG 2005.
31 .Dynamic Determination of Filenames Should you upload from client workstation or the application server? It is preferable to use the server path advantages: Data load in batch mode is possible Path is physically equal to all administrators Scenario in which to use it: Transaction data is delivered monthly by flat file The naming convention includes the name of the month within the filename Directory paths are maintained for every year Coding: Concatenate Directory path Actual year Actual month © SAP AG 2005.
32 .Data Staging (3) Overview Overview InfoPackages InfoPackages Start Routines Start Routines Transfer Rules Transfer Rules Update Rules Update Rules © SAP AG 2005.
33 .Call of Start Routines Start routines are processed: – After the data is written into the PSA – Before the transfer rules are processed Start routines do get as a parameter the whole data package structured in the form of the transfer structure © SAP AG 2005.
Classic Usage – Transfer Rules Particularly the start routine of the transfer rules gives “classic” scenarios of usage: Selective deletion of records delivered with the data package Coding example: DELETE DATAPAK WHERE VKORG = “1000. 34 .” Advantage: Smaller data package loading performance improves Reasons why (examples): The InfoPackage from the data source does not offer selection criteria The processing time with a selection from the InfoPackage sent to the source system takes considerably more time than without selection The deletion criteria is easy to code within the start routine Fill an internal table from a DDIC select (please refer to the performance aspects) Complex data cleansing or data consolidation from various source systems eventually with a look up as ETL process © SAP AG 2005.
. when multiple basis cubes are consolidated into one Segmentations of characteristic values in order of key figure numbers (e.g.g. ABC classification on characteristic values) © SAP AG 2005. e.Typical Scenarios – Update Rules Fill an internal table from a database table (DDIC) (please refer also to performance aspects) Look up scenarios when loading into data targets Add or append information from other data providers or data stores 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. 35 ..
Data Staging (4) Overview Overview InfoPackages InfoPackages Start Routines Start Routines Transfer Rules Transfer Rules Update Rules Update Rules © SAP AG 2005. 36 .
© SAP AG 2005. 37 Give the routine a name Mark the fields with which you want to work .Call of Transfer Rule Routine 1. 2. 2. Edit transfer rules Create routine Transfer rule routine dialog: 1. 3.
Data Staging (5) Overview Overview InfoPackages InfoPackages Start Routines Start Routines Transfer Rules Transfer Rules Update Rules Update Rules © SAP AG 2005. 38 .
39 .InfoCube Characteristic Update Rule ODS-Object Key Field Update Rule 1 2 Characteristic assignment – change of source (1) Give a name for the update rule (2) 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.
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. 40 . 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.
Interface: Global data declaration within the header works in the same way as the start routine and characteristics The form routine “compute_data_field” delivers following parameters: The table MONITOR for monitoring The table RESULT_TABLES with the structure of the data target 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 The structure of the data target is assigned with the parameter ICUBE_VALUES © SAP AG 2005.... (1) .Speciality: Return Table 1 2 If it is necessary to use a return table the generated update rule differs marginally . 41 .. (2) ...
and Characteristics 5) ABAP in Process Chains Summary Appendix © SAP AG 2005. Key Figures.Agenda Introduction 1) Data Extraction 2) Data Staging 3) BEx Variables 4) Virtual InfoCubes. 42 .
43 .BEx-Variables One way to fill a variable value is to use ABAP coding We can differentiate between two alternatives: 1. Fill the value independently with a program 2. Fill the value dependent on an other variable value © SAP AG 2005.
BEx-Variables (cont. called "steps" (I_STEP) © SAP AG 2005. 44 .) 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.
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.) 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.” 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. 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.BEx-Variables (cont. “customer exit. 45 .
BEx-Variables (cont. 46 .) 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.
Agenda Introduction 1) Data Extraction 2) Data Staging 3) BEx Variables 4) Virtual InfoCubes. 47 . Key Figures. and Characteristics 5) ABAP in Process Chains Summary Appendix © SAP AG 2005.
48 .Business Scenario Standard deviation formulas are calculated for variable versions and fiscal years Calculation in the query is too complex because the formula needs to be calculated on a fixed granularity (often more detailed than the query) Calculation in the Administrator Workbench is too inflexible because there are too many combinations of years and versions Warning: This exit is very powerful but can cause huge performance problems © SAP AG 2005.
What Is a Virtual Characteristic or Key Figure? A virtual characteristic or a virtual key figure is an InfoObject. 49 . which is defined within the InfoProvider as metadata without having any data stored physically Historical Background: The BAdI RSR_OLAP_BADI replaces the user exit RSR00002 with the following advantages: Easier to implement Different classes for different InfoCubes/implementations No large includes © SAP AG 2005.
50 .Virtual Key Figures and Characteristics Three Implementation Steps: Three Implementation Steps: 1) Creating a BAdI Implementation 1) Creating a BAdI Implementation 2) Implementation of the DEFINE Method 2) Implementation of the DEFINE Method 3) Implementation of the COMPUTE Method 3) Implementation of the COMPUTE Method © SAP AG 2005.
Virtual InfoCubes with Services Definition: InfoCube that does not have its own physical data storage in SAP BI User-defined function module is used as data source Properties of data source can be defined more precisely using several options. 51 . You can also use your own calculations to change the data before it is passed to the OLAP processor © SAP AG 2005. Depending on these properties. the Data Manager provides services for converting parameters and data 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.
and Characteristics 5) ABAP in Process Chains Summary Appendix © SAP AG 2005. 52 .Agenda Introduction 1) Data Extraction 2) Data Staging 3) BEx Variables 4) Virtual InfoCubes. Key Figures.
53 .ABAP in Process Chains Process Chains Process Chains Insert Process "ABAP Program" Insert Process "ABAP Program" Implementing New Process Types Implementing New Process Types © SAP AG 2005.
54 .Process Chains Maintenance in RSPC © SAP AG 2005.
55 .ABAP in Process Chains Process Chains Process Chains Insert Process "ABAP Program" Insert Process "ABAP Program" Implementing New Process Types Implementing New Process Types © SAP AG 2005.
56 . Insert process “ABAP Program“ Create new process variant © SAP AG 2005. 1. 2.Insert ABAP Program Transaction Code RSPC: 1. 2.
Create new process variant: technical name and description Maintain process variant 2.Create Variant 1. 2. 57 . © SAP AG 2005. 1.
Maintain Variant – Program to Call/Called From Programs with or without variants Predefined events of the application or events you defined yourself The background processing system receives events (signal stating that a predefined status has been reached) and then starts the job Program runs on the same server in which the chain is scheduled Scheduled program waits for an event on the target server © SAP AG 2005. 58 .
ABAP in Process Chains Process Chains Process Chains Insert Process "ABAP Program" Insert Process "ABAP Program" Implementing New Process Types Implementing New Process Types © SAP AG 2005. 59 .
. . have a simple.....Implementing a New Process Type If you ....... have a program. which is more difficult than the “parameters“ of a program ... want to ask predecessor processes of your program . stand-alone program to run in a chain ... which should be displayed in the process monitor . have implemented an own monitor .. if you . . write a log. which is planned in batch by another program or user .. then it is recommended to custom develop your own process type © SAP AG 2005... 60 . have a customizing screen.. then you can use the process type "ABAP" to run your program in a chain However.
and Characteristics 5) ABAP in Process Chains Summary Appendix © SAP AG 2005. 61 . Key Figures.Agenda Introduction 1) Data Extraction 2) Data Staging 3) BEx Variables 4) Virtual InfoCubes.
62 .7 Key Points to Take Home Know where the SAP BI backend can be enhanced using ABAP Implement enhancements as close to the source system as possible Knowledge about general ABAP performance tuning is mandatory Often there are several options for the implementation – choose wisely Check the documentation and example implementations Read how-to papers available on the SAP Service Marketplace Sign up for SAP Developer Network © SAP AG 2005.
administrators and developers Focus around SAP NetWeaver and SAP xApps High quality of technical resources Articles. and code-samples A collaboration platform. weblogs. contribute.com The central hub for the SAP technology community Everyone can connect. 63 . how-to guides.sap. discussion forums. not a one-way street SAP experts from customers.For More Information: Access the SAP Developer Network – www. partners and SAP SDN is powered by SAP NetWeaver™ Built on the SAP Enterprise Portal Featuring collaboration capabilities of SAP Knowledge Management © SAP AG 2005. and collaborate – consultants. toolkits.sdn. collaborative areas. downloads.
Questions? Marc. 64 .com Q&A © SAP AG 2005.bernard@sap.
and Characteristics 5) ABAP in Process Chains Summary Appendix (not shown during presentation) © SAP AG 2005. 65 .Agenda Introduction 1) Data Extraction 2) Data Staging 3) BEx Variables 4) Virtual InfoCubes. Key Figures.
6.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.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. 66 . respectively) © SAP AG 2005. 3.
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 .
68 .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.
SAP Enhancements and BAdIs (cont. 69 .0B SP8) © SAP AG 2005.) RSAP0001 exits parallel with RSU5_SAPI_BADI RSR00001 see Note 492445 Enhancement for reporting variables RSR00002 exists parallel with RSR_OLAP_BADI RSR00004 automatically migrated to BAdI SMOD_RSR00004 Report-Report-Interface RSSBR001 obsolete (deleted with rel. 3.
70 . combination proposal. derivation Enhancement SEMBPSU01 obsolete Characteristic validation Enhancement SEMBPSU02 obsolete Characteristic derivation © SAP AG 2005.Exits in Business Planning and Simulation (BW-BPS) Planning functions of Type "Exit" Variables of Type "Exit" Characteristic relationships of Type "Exit" Combination check.
Runtime Analysis of ABAP Statements Transaction: SE30 Choice of Different ABAP Statements Tips and Tricks Runtime Analysis of ABAP Statements Documentation of ABAP Statements © SAP AG 2005. 71 .