You are on page 1of 14

How to Schedule Query Extracts using RSCRM_BAPI

B USINESS I NFORMATION W AREHOUSE

ASAP How to Paper

Applicable Releases: 2.1C, 3.x


SAP (SAP America, Inc. and SAP AG) assumes no responsibility for errors or omissions in these materials. These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. mySAP BI How -To papers are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using mySAP BI. Should you wish to receive additional information, clarification or support, please refer to SAP Professional Services (Consulting/Remote Consulting).

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

August 2004

1998 SAP AMERICA , I NC. AND SAP AG

TABLE OF CONTENTS

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

1 Business Scenario
You want to download BW query results. Those file download results should arrive either in flat files, or in transparent tables. The downloaded files should be based on existing BEX query definitions. And most of all, the downloads should be executed repeatedly and fully automated in the background.

2 Introduction
The following step-by-step guide describes how you can achieve the desired results of query result download. It is based on transaction code RSCRM_BAPI, a function available in BW 2.1c since SP 8.

Before you proceed, please view the following important notice: As of release 3.0B (as well as 3.0ASP7), a new functionality called SAP BW Open Hub is available, that enhances BWs openness in an Enterprise Data Warehouse environment. Therefore SAP BW is even more capable of taking over the role of an Open Hub Platform, and to function as well as an information hub and distributor. The Open Hub functionality largely enhances the openness of BW, its capabilities surpass the RSCRM_BAPI capabilities by large. In any case, independent of which extraction method you choose (RSCRM_BAPI, OpenHub, or other tools like LISTCUBE), it is important to note that SAP BW Enterprise Data Warehouse de facto will function as an Open Hub Platform. Since extracting data from SAP BW by any means requires additional licensing, please make sure to contact your SAP representative.

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

3 Background
The transaction RSCRM_BAPI in the SAP BW system was created for the purpose of testing a programming interface for extracting query results from SAP BW. This programming interface takes the query definitions as the basis for generating MDX statements that are transferred to the ODBO interface in SAP BW. The result generated is either returned to the callup program as an internal table or updated in tables and files.

Although the functions and performance with the transaction RSCRM_BAPI is comparable to the functionality offered by the Business Explorer Analyzer, certain aspects and in particular some restrictions ought to be considered before deciding whether to opt for these transactions in a project.

4 Restriction of RSCRM
Certain queries that can be defined in the Business Explorer Analyzer cannot be supported by RSCRM_BAPI due to the limitations of the ODBO interface. This applies to the following queries: Queries that use the operators CT, RT, and GT as well as %CT, %RT, and %GT in calculated key figures Queries that use replacement path variables while the reference query uses variables that are open for input. User exit variables, on the other hand, are supported.

Furthermore, the ODBO interface expects there to be filters and variable values in the InfoCube it is based on. To achieve this, these values are checked upon input, which can lead to longer response times in such cases.

The ODBO interface does not support filter and variable values that contain special characters, accents, or characters in the lower case. This restriction applies regardless of which additional characters are permitted for key values in the SAP BW settings. Accents such as the German "Umlaut", however, are supported for displaying the results.

In the case of Top N conditions, the resulting set might vary between the Business Explorer Analyzer and the ODBO interface if multiple identical values occur due to different sort processes.

If a default value is defined for a variable, the ODBO interface always applies this value, even if it had been explicitly deleted manually in the variable dialog box. It is recommended that you do not use default values.

Variables with the dynamically changeable flag enabled are not supported by ODBO.

Output values for missing or invalid key figure values can be defined in the settings for SAP BW using transaction RSCUSTV4. If nonnumeric output values are defined for this case, the key figure value will be set to zero.

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

When the query results are written to tables, the structure of the query is converted so that characteristics appear in the rows and key figures in the columns, thereby supporting a flat table model.

When the query results are written to tables, the characteristics of a query are used in the generated table as key fields. Due to the restrictions imposed by the Data Dictionary, the combined width of all key fields must not exceed 255 bytes. The number of active characteristics is limited to 16 as well.

Queries for the InfoProviders "InfoObject" and "InfoSet" are not yet supported by RSCRM_BAPI. We are currently in the process of releasing this functionality for BW 3.x. .

Its advised to have a deeper look at note 605208, which describes even more critical restrictions!!!

5 Performance
The ODBO interface in SAP BW is intended to be used in OLAP applications for performing complex requests with multidimensional data. It has been optimized for this purpose, not for reading mass data. The ODBO interface has not been released for extracting mass data from SAP BW.

For some queries, execution with the ODBO interface can in some instances take considerably longer than with the Business Explorer Analyzer. Moreover, server memory consumption during complex queries can also be fairly high. This is the case if, for example, a large number of characteristics are used in the drilldown (unlike in typical OLAP applications). Characteristics that are not essential should always be removed. The same applies to any superfluous attributes and key figures. Characteristics serving simply as filter characteristics should not appear in the drilldown; they should be defined as free characteristics instead.

Note that conditions can only be active within a query while the characteristics used are still in the drilldown. If this is not the case, the condition is automatically deactivated.

Packaging
To avoid memory bottlenecks RSCRM_BAPI allows you to use the packaging option (semi-automatic division of a query into several individual requests). To do this, you select a characteristic during scheduling. All values belonging to this characteristic that are found in the InfoCube are automatically divided into intervals of appropriate size ("packages") and these packages are then transferred as interval filters to individual batch jobs.

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

Number of Characteristics in the Drilldown 1 2 3 >=4

Package Size 10000 1000 100 2

The size of the packages is set automatically on the basis of the number of characteristics in the drilldown. With BW 2.1C SP8, however, you have the option of specifying the package size explicitly (by choosing Extras Package Size: Extract in the menu). With BW3.x and an up-to-date SP its now even possible to set an individual package size per extract.

The set of characteristics that can be used depends on the query design. Only active characteristics are possible. Furthermore it depends on the created conditions. If a condition is set to be evaluated independently or if a Top or Bottom condition exist on the 1st characteristics its not possible to package the query at all. Because of the nature of those conditions they can only be evaluated on the whole query at once.

The possible set of characteristics depends further on their use in conditions. E.g. characteristics that are used in conditions with the type "Top-Count", "Bottom-Count", "Top-Sum", "Bottom-Sum", "TopProduct", and "Bottom -Product" are not allowed to be selected for packaging since the total resulting set would otherwise fail to fulfill the defined condition. Please use the F4 help as it will only offer possible characteristics.

Direct InfoProvider access


If a query doesnt use any OLAP features beside aggregation it can also be displayed as a request to the InfoProvider interface in SAP BW. Then the request in the transaction RSCRM_BAPI is automatically directed at this interface instead of at the ODBO interface. In this way, performance and memory bottlenecks in the ODBO interface can be avoided.

The InfoProvider interface can be used internally if the query does not contain the following elements: Conditions Hierarchies Exit variables Characteristics in columns Key figures in rows Restricted and calculated key figures Date key figures Currency translation Concurrently a variable and a filter on a characteristic

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI Variables on compounded characteristics Stock key figures Exception aggregation

Moreover, the InfoProvider has to be a BasicCube with an empty E-table or an ODS .

If the above conditions are fulfilled, the data can be transferred directly from the InfoProvider. Doing so can have considerable performance benefits. With an up-to-date SP theres an OLAP Check button in the toolbar that gives an explanation on which prerequisites of the current query are not fulfilled.

6 For the Latest Information


For the most up-to-date information on restrictions and performance issues related to RSCRM_BAPI , see note 515552.

7 The Step By Step Solution


The following steps describe a practical application of the usage of RSCRM_BAPI. The first chapter deals with the creation of the relevant query, and the second chapter describes how to execute and monitor the extraction download. Finally, in the appendix you can find a listing of FAQs (frequent asked questions), with the respective answers.

Define a query and enable it for OLE DB


1. Define a query, which serves as a default layout for your data downloads from an InfoCube or ODS.

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

2. Under query properties, make sure to mark the checkbox Release for OLE DB for OLAP. Then generate and safe the query.

Create and schedule an extract


1. In BW, execute transaction code RSCRM_BAPI. On the next screen, you will see a listing of all queries available in the BW system, which are OLE DB enabled. Double-click on the query that you want to execute.

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

2. Now you are on the main screen of transaction RSCRM_BAPI. Although there is a variety of features available on this screen, for the purpose of this How-To Paper lets focus on the query result download functionality. From the menu icons, click on Extract.

3. Now you are on the definition screen for a query extract. You will need to provide the following information: Technical Name of Extract: You have to choose a unique technical name, which identifies the extract that you want to create. This name is used for the table creation in DDIC (or for the structures generation in DDIC, in case that you choose file output). The generated technical name will be constructed as follow s: /BIC/0C + technical name (Up to BW2.1c/SP7: ZCRM + technical name). The files can be found in the directory DIR_HOME (to be defined via transaction code AL11). User: This is the user id, which will be used for extract creation. This user id needs to have authorization to execute the query; starting from

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

BW2.1c/SP8, also the authorization object RSCRMEXTR is checked. Language: Language chosen for textual information in the extract. Packaging on Characteristic: This is basically a partition criteria, which allows you to break down the query execution / extract into several smaller packets. It is required in case of large data volumes, in order to avoid an ODBO memory overflow. (Note: This option cannot be chosen in case of conditions, like TOPN etc.). Package Size: This is the size of each package. Extract Type: There are three options for results output. CSV- or fixedlength flat file, or transparent table. Extract Contents (table only): In case that you had chosen the transparent table for file output, select whether you want to reinitialize the table for every extract, or if you simply want to append to an existing table. File Parameters (file only): In case of flat file output, define the file name for output. Should the file already exist, it will be overwritten. Note, that only files on the application server are allowed here; you cannot choose files on the client machine.

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

Start Condition: Use the usual BW scheduling features to plan the data extract.

4. In case that you had defined user input variables in the query, now you will be prompted for the variable values. Enter the variable values (either manually or via variant), and then press the Continue icon. Now your job is scheduled or executed (depending on the start conditions selected above). 5. Back on the main screen, you can branch now to the monitor, via the icon Batch Monitor.

2004 SAP LABS, LLC. AND SAP AG

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

6. A traffic light will indicate the status of the process. If the traffic light is yellow, you know that the process is still running. It has finished without errors, when you see a green icon. A red icon would indicate a problem situation, which would require individual further research.

7. You can double-click on the traffic signal for further details. The new Package Information tab shows details of each package.

8. From the menu, you can also display the table / file contents (transaction AL11 is called in case of files).

2004 SAP LABS, LLC. AND SAP AG

10

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

2004 SAP LABS, LLC. AND SAP AG

11

HOW TO SCHEDULE QUERY EXTRACTS USING RSCRM _BAPI

Appendix

Frequently Asked Questions (FAQs)


1. Can BEX custom Visual Basic (VB) coding be read via RSCRM_BAPI?
No, any custom VBA coding on top of BEX workbooks is ignored.

2. For which releases is the functionality available?


RSCRM_REPORT, which is similar to RSCRM_BAPI, is available since BW 2.0b / 2.1. Its not advised to uses RSCRM_REPORT. RSCRM_BAPI is available since BW 2.1c / SP8. Also, both transactions will continue to be available with BW releases 3.0a / 3.0b.

3. What alternative methods are there to download data from BW?


For automated data extracts from BW, you also might want to consider the following approaches: 1. 2. 3. 4. 5. 6. Exception reporting, to be scheduled in the background via the Admin. Workbench. Batch printing output to the printer queue. Custom developments against OLAP BAPI / OLEDB interface. Infosets or custom developments against ODS tables (2.0). Custom developments against ODS BAPI (BW 3.0a). Open Hub functionality (BW 3.0b / BW3.0aSP7).

4. Does the usage of RSCRM_BAPI require additional user licenses?


Yes. Whenever you extract data from the mySAP BI environment into 3rd-party target systems your SAP BW Enterprise Data Warehouse functions as an Open Hub Platform. Since extracting data from SAP BW by any means requires additional licensing, please make sure to contact your SAP representative.

2004 SAP LABS, LLC. AND SAP AG

12

You might also like