Sie sind auf Seite 1von 37

User Exits in SAP BW

Know How Network Call 16.12.1999


SAP AG BW Development
SAP AG, Dec. 1999 (Joachim Mette) Slide 1

Definition User-Exit
For many SAP customers, the options available in customizing are not sufficient, since they wish to change and adapt SAP transactions to suit their own requirements. The problem here is that, after every maintenance level or release upgrade, the changes have to be adjusted to coincide with SAP corrections and developments. To reduce this effort in a SAP System (or to avoid it totally), customers can make their own enhancements in a layer separate from SAP. Rather than make changes to the original code, they make them in their own special area. This is created by SAP and delivered empty or with standard values during system installation. Customers can implement additional functionality in this area. The applications programmer makes the necessary transaction data explicitly available via an interface.
SAP AG, Dec. 1999 (Joachim Mette) Slide 2

User-Exits in BW

Browser

3rd party OLAP client

Analyzer (hosted by MS Excel)

Business Explorer
ODBO BAPI

Administrator Workbench
Administration Scheduling

BW Server
Meta Data Repository

OLAP Processor

Meta Data Manager

Data Manager

InfoCubes Operational Data Store

Staging Engine

Monitor
BAPI

Non R/3 Production Data Extractor


Non R/3 OLTP Applications

Production Data Extractor

OLTP Reporting

R/3 OLTP Applications

SAP AG, Dec. 1999 (Joachim Mette) Slide 3

1. Extending the Business Content

SAP AG, Dec. 1999 (Joachim Mette) Slide 4

Extending the Business Content

SAP AG, Dec. 1999 (Joachim Mette) Slide 5

User-Exit for Variables


Enhancement: RSAP0001 The components for the enhancement are the function modules: EXIT_SAPLRSAP_001 (Transaction Data)
This function module allows you to fill user-defined fields that you have attached to existing InfoSources as append structures.

EXIT_SAPLRSAP_002 (Master Data Attributes)


This function module allows you to fill user-defined fields that you have attached to master data structures of the BW as append structures

EXIT_SAPLRSAP_003 (Texts)
This function module allows you to change the contents of a generated text transfer table for a text request. This can be useful if only one short text exists for an InfoObject but you would like to attach the mediumlength text from the user-defined table.

EXIT_SAPLRSAP_004 (Hierarchies)
This function module allows you to change the contents of a transfer table created for a hierarchy request.
SAP AG, Dec. 1999 (Joachim Mette) Slide 6

EXIT_SAPLRSAP_001: Interface - Importing


I_ISOURCE
I_UPDMODE

Name of the InfoSource


Transfer mode, as requested in the Scheduler of the Business Information Warehouse.

SAP AG, Dec. 1999 (Joachim Mette) Slide 7

EXIT_SAPLRSAP_001: Interface Exporting/Tables


I_T_SELECT
I_T_FIELDS

Table with the selection criteria stored in the Scheduler of the BW


List of the transfer structure fields. Only these fields are actually filled in the data table and can be sensibly communicated with in the program. Table with data received from the API in the format of the source system entered in table ROIS (field ROIS-STRUCTURE).

C_T_DATA

SAP AG, Dec. 1999 (Joachim Mette) Slide 8

EXIT_SAPLRSAP_002: Interface - Importing


I_CHABASNM
I_UPDMODE

Name of the Characteristic


Transfer mode, as requested in the Scheduler of the Business Information Warehouse.

SAP AG, Dec. 1999 (Joachim Mette) Slide 9

EXIT_SAPLRSAP_002: Interface Exporting/Tables


I_T_SELECT
I_T_FIELDS

Table with the selection criteria stored in the Scheduler of the BW


List of the transfer structure fields. Only these fields are actually filled in the data table and can be sensibly communicated with in the program. Table with data received from the API in the format of the source system entered in table RODCHABAS (field RODCHABAS-STRUCTURE).

C_T_DATA

SAP AG, Dec. 1999 (Joachim Mette) Slide 10

EXIT_SAPLRSAP_003: Interface - Importing


I_CHABASNM
I_UPDMODE

Name of the Characteristic


Transfer mode, as requested in the Scheduler of the Business Information Warehouse.

SAP AG, Dec. 1999 (Joachim Mette) Slide 11

EXIT_SAPLRSAP_003: Interface Exporting/Tables


I_T_SELECT
I_T_LANGU

Table with the selection criteria stored in the Scheduler of the BW


Table with the languages for which the texts were requested.

C_T_TEXTS

Table with data received from the API in the format of the structure RSTEXTTRSF.

SAP AG, Dec. 1999 (Joachim Mette) Slide 12

EXIT_SAPLRSAP_004: Interface - Importing


I_S_REQUEST
I_S_HIEBAS I_S_HIEFLAG I_S_HIER_SEL

Processing parameters for the data request


Information about the Characteristic Hierarchy control indicator Structure that contains the requested hierarchy.

SAP AG, Dec. 1999 (Joachim Mette) Slide 13

EXIT_SAPLRSAP_004: Interface Exporting/Tables


I_T_LANGU
C_T_HIETEXT

Table with the language in which the descriptions are requested.


Table with the description of the hierarchy in the requested language.

C_T_HIENODE
C_T_FOLDERT

Table with all components of the hierarchy.


Table with the descriptions of all nodes that cannot be posted to in the hierarchy in the requested language.

C_T_HIEINTV

Table with those hierarchy sheets that represent value intervals.

SAP AG, Dec. 1999 (Joachim Mette) Slide 14

2. User Exit after Data loading

SAP AG, Dec. 1999 (Joachim Mette) Slide 15

Data Load : Procedure


BW
User Exit after Data Load

call
red

InfoPackage
yellow green

Scheduler

Monitor

Pull

Extraction engine

OLTP System
SAP AG, Dec. 1999 (Joachim Mette) Slide 16

User Exit after Data loading Function module: rssm_start_second_process Function module is called when exiting the request as well as when exiting the InfoPackageGroup. See also Note 137991

SAP AG, Dec. 1999 (Joachim Mette) Slide 17

Interface - Importing

RNR
TSTATUS

Request number of the load process


Status (Icon_green_light for exited successfully or Icon_red_light for exited incorrectly or space for InfoPackgegroup exited without check)
(@08@ = green, @09@ = yellow, @0A@ = red)

SOURCE LOGSYS

InfoSource for which data was loaded Source system for which data was loaded

TYP
GNR

Type of data (D=transaction data, M=master data attributes, T=texts, H=hierarchies)


Group request number (only filled, if function module is called at the end of an InfoPackage Group)

SAP AG, Dec. 1999 (Joachim Mette) Slide 18

Interface - Importing

WRITE_TO_ODS

= X if something is written to the ODS (not filled if function module is called by InfoPackageGroup)

WRITE_TO_CUBE = X if something is written to an InfoCube (not filled if function module is called by an Info PackageGroup) GROUP_CALL = X if function module is called by an InfoPackageGroup, otherwise space

SAP AG, Dec. 1999 (Joachim Mette) Slide 19

Scenario 1: Delete old request

InfoCube

Monitor

Infopackage

User Exit after Data Load

Request-No.1 (Full Load) (04.01.1999)

Delete last Request

Request-No.2 (Full Load) (11.01.1999)

Check

Sourcesystem

SAP AG, Dec. 1999 (Joachim Mette) Slide 20

Scenario 2: Send Mail after data load

InfoCube

Monitor

Infopackage

User Exit after Data Load

Request-No.1 (Initial Load) (04.01.1999)

Send Mail

Request-No.2 (Delta Load) (11.01.1999)

Send Mail

Sourcesystem

SAP AG, Dec. 1999 (Joachim Mette) Slide 21

3. User Exit for Variables

SAP AG, Dec. 1999 (Joachim Mette) Slide 22

User-Exit for Variables


Enhancement: RSR00001 The component for the enhancement is the function module EXIT_SAPLRRS0_001.

SAP AG, Dec. 1999 (Joachim Mette) Slide 23

How to program a corresponding Include


Create variable with corresponding type for User Exit Call up transaction CMOD in the Admin. Workbench Create a Project Select Enhancement Components Select Enhancement RSR00001 Double-click on Exit EXIT_SAPLRRS0_001 Double-click on include ZXRSRU01 within the Exit Add or change coding Don't forget to activate the Project

Use the variable in a query

SAP AG, Dec. 1999 (Joachim Mette) Slide 24

Interface - Importing
I_VNAM
I_VARTYP

Name of the Variable; without &-signs


1: Characteristic Value 2: Hierarchy node(s) 3: Text 4: Formula 5: Hierarchy Name of the InfoObject Information about InfoObject (Dataelement, CheckTable, Length, Number of Decimals, ...) Information about Reporting-Object; here Query (Queryname, InfoCube, ...) Fiscal year variant Table with all Variables and their values 1: Before Variable Pop up 2: After Variable Pop up

I_IOBJNM I_S_COB_PRO I_S_RKB1D I_PERIV I_T_VAR_RANGE I_STEP


SAP AG, Dec. 1999 (Joachim Mette) Slide 25

Interface Exporting
E_T_RANGE
E_MEEHT E_MEFAC E_WAERS E_WHFAC

Table to return the values fields: low, high, sign, opt


Unit of measure Number of Decimals for Unit Currency Code Number of Decimals for Currency Value

SAP AG, Dec. 1999 (Joachim Mette) Slide 26

Call-Sequence

First Call of the User-exit

Pop up to enter values for the variable (if "Ready for Input" = 'X')

Second Call of the User-exit


if Variable of type "Mandatory variable entry" is not filled if Text-variable is not filled

SAP AG, Dec. 1999 (Joachim Mette) Slide 27

4. Virtual Characteristics and Virtual Key figures

SAP AG, Dec. 1999 (Joachim Mette) Slide 28

User-Exit for Virtual characteristics and key figures


Enhancement: RSR00002 The components for the enhancement are the function modules EXIT_SAPMRSRU_001 and EXIT_SAPMRSRU_999.

SAP AG, Dec. 1999 (Joachim Mette) Slide 29

What is a Virtual Characteristic / Key figure


A virtual characteristic / key figure is an object of the InfoCube. The values are derived at query run time.

Examples:
The SalesRep is derived from Product and Customer. This assignment changes frequently. Therefore the value for the characteristic SalesRep can not be stored in the Cube.

You want to calculate with key figure-type attributes of an InfoObject. E.g. Price is an attribute of Product. Sold-quantity is an object of the InfoCube. You want to see the revenue (Soldquantity * Price) in your query. You have an "Open-order-InfoCube". One InfoObject is the Orderdate. You need a list with the number of days btw. the orderdate and today.

SAP AG, Dec. 1999 (Joachim Mette) Slide 30

How to program a corresonding Include


You must firstly define the characteristics, or key figures within the InfoCube Call up transaction CMOD in the Admin. Workbench

Create a Project
Select Enhancement Components Select Enhancement RSR00002

Double-click on Exit EXIT_SAPMRSRU_001


Double-click on include ZXRSRU02 within the Exit Display or change coding

Maintain include ZXRSRTOP


Maintain include ZXRSRZZZ Don't forget to activate the Project
SAP AG, Dec. 1999 (Joachim Mette) Slide 31

Interface Importing/Exporting
Importing:
I_S_RKB1D Information about Reporting-Object; here Query (Queryname, InfoCube, ...)

Exporting: E_T_CHANM Table with the name of the virtual characteristics

E_T_KYFNM

Table with the name of the virtual key figures

SAP AG, Dec. 1999 (Joachim Mette) Slide 32

Remarks
You should note that the data records transferred can be on a different aggregation level depending on read procedure and drilldown.
Moreover, compound information is not automatically changed with compounded characteristics after changing a higher-level characteristic. In addition, the compound characteristic must also be defined in the mode RRKE_C_MODE-NO_SELECTION. Furthermore, the fiscal year (0FISCYEAR), the fiscal year period (0FISCPER) and the fiscal year variant (0FISCVARNT) cannot be read or changed in the enhancement. (*) Enhancement 999 may not be changed. Calling up serves to update information via the structure C_S_DATA. This functionality is completely taken over by form USER_INIT_GLOBALS.
SAP AG, Dec. 1999 (Joachim Mette) Slide 33

Remarks
Can you use a Navigational Attribute on top of a Virtual characteristic?
Select joins with At this time the Virtual characteristic is initial. The attribute is the value of the initial-entry from the master-data table

The User-exit is called after the select

Now, the Virtual characteristic is filled

Solution: Don't use a Navigational Attribute, use a virtual characteristic for the attribute value.
SAP AG, Dec. 1999 (Joachim Mette) Slide 34

5. User Exit in BEx

SAP AG, Dec. 1999 (Joachim Mette) Slide 35

User Exit in BEx: Call "on refresh"

BW Server
Remote Function Call Microsoft Excel Business Explorer Analyzer (Excel Add-in SAPBEX.XLA)
Call on refresh

Query Directory Exits (hidden)


State of Query 1 State of Query 2 State of Query 3

API Calls

Results Query 1 Results Query 2 Worksheet 1

Results Query 3

VBA VBA Modules Modules

Worksheet 2 Workbook

SAP AG, Dec. 1999 (Joachim Mette) Slide 36

SAPBEXonRefresh
When the first query is added to a workbook, the Analyzer will also add a VBA subroutine to the workbook:
Sub SAPBEXonRefresh(queryID as String, resultArea as Range)

' your own code goes here ...


' example: MsgBox queryID ' example: MsgBox resultArea.rows.count ' example: resultArea.AutoFilter

End Sub

This subroutine will be called each time a query is refreshed in the workbook resultArea holds the result area after the refresh queryID specifies which query has been refreshed

SAP AG, Dec. 1999 (Joachim Mette) Slide 37

Das könnte Ihnen auch gefallen