SAP BI Generic Extraction Using a Function Module



Similar documents
Scenario... 3 Step-by-Step Solution Virtual Infocube... 4 Function Module (Virtual InfoCube)... 5 Infocube Data Display... 7

Step by Step Guide How to Copy Flat File from Other Application Server to BI and Load through Info Package

BOM Header and Item Extraction in SAP - Business Intelligence

Step by Step Guide to Extract Batch Master Data via Generic and Classification Datasource to BW

Step by Step Guide for Language Translation Tool

SAP BW - Generic Datasource Function Module (Multiple Delta Fields)

SAP BW - Excel Pivot Chart and Pivot Table report (Excel)

Release Strategy Enhancement in Purchase Order

Extractor in R/3 and Delta Queue

Step by Step Guide to Create a Generic Datasource Based on Infoset Query Populated Via External Program

Step by Step Procedures to Load Master Data (Attribute and Text) from FlatFile in BI 7.0

SAP BW 7.3: Exploring Semantic Partitioning

Data Extraction and Retraction in BPC-BI

Quick Viewer: SAP Report Generating Tool

Deleting the Requests from the PSA and Change Log Tables in Business Intelligence

Data Flow from LBWQ/SMQ1 to RSA7 in ECC and Delta Extraction in BI

Deploying Crystal Reports on Top of a SAP BI Query

LSMW: Upload Master Data using Batch Input Recording

This article demonstrates in a step-by-step process to write ABAP Reports that use BAPI function modules.

Dynamic Authorization Concept and Role Assignment in BI

Working with SAP BI 7.0 Data Transfer Process (DTP)

Reverse Transport Mechanism in SAP BI

Customer Exit Variables in SAP BW/BI Reports First day of the Current/Previous Month

ALE Settings, for Communication between a BW System and an SAP System

BW Performance Monitoring

Standard SAP Configuration of SMS through HTTP with Third Party SMS Gateway

Compounding in Infoobject and Analyzing the Infoobject in a Query

ALV List with Radio Buttons

Restricting Search Operators in any Search View

Multi Provider Creation Based on Sales and Planning Info Cubes

Creating Transaction and Screen Variants

Embedding Crystal Reports inside ECC ALV Reports

Application Logging in SAP Using ABAP

Display Options in Transaction SE16

Web Application Designer for Beginners

SAP BI/BW LO Extraction

Understanding BW Non Cumulative Concept as Applicable in Inventory Management Data Model

SAP CRM-BW Adapter an Overview

How to Generate Stack Xml for Ehp4 and Above Upgrade

Creating New Unit of Measure in SAP BW

How to Load Data from Flat Files into BW PSA

Currency Conversion using Variables in SAP BI -Reporting

Deleting the User Personalization done on Enterprise Portal

ABAP How To on SQL Trace Analysis

Understanding DSO (DataStore Object) Part 1: Standard DSO

Splitting the Custom Container & Display more than one ALV

Connecting to SAP BW with Microsoft Excel PivotTables and ODBO

Mandatory Field Check in Web Dynpro- ABAP

Creating Mobile Applications on Top of SAP, Part 1

Abstract...3 Business Scenario...3. Challenges:...3 Solution Benefits:...3. Development Specification...4 Design Overview...5

Converting and Exporting Data in XML Format

Table of Contents. Passing Data across Components through Component Controller between Two Value Nodes

How to Assign Transport Request for Language Translation?

Message handling in SAP CRM Web UI

SAP BW Data Source Enhancement

Introduction to COPA and COPA Realignment

Step by Step guide of Report-to- Report Interface in BW Reporting

Offsetting Account Description in FBL3N and FAGLL03 GL Line Item Display Reports

Inventory Management (0IC_C03) Part - 3

Exposing RFC as Web Service and Consuming Web Service in Interactive Forms in ABAP

Creating Content Using SO10 Objects and Text Symbols

Configuring HTTPs Connection in SAP PI 7.10

Creating and Scheduling Publications for Dynamic Recipients on SAP Business Objects Enterprise

Inventory Management in SAP BW

How to Modify, Create and Delete Table Entries from SE16

APD to Update Marketing Attributes from SAP BI to SAP CRM

Table of Content. SAP Query creation and transport Procedure in ECC6

This document applies to SAP ECC 6.0, SAP Netweaver 2004s. For more information, visit the Web Dynpro ABAP homepage.

SAP FI - Automatic Payment Program (Configuration and Run)

SPDD & SPAU Adjustments Handbook

Step by Step Procedure to Block and Debug a CIF Queue Flowing from R/3 to APO System

Data Source Enhancement Using User Exit

Different Types of Alerts for Process Chains. Table of Content

Create Automatic Mail Notification/ Alert for Process Chain Monitoring

Creating Web Service from Function Modules/BAPIs & Integrating with SAP Interactive Forms

How to Extract Data for Multi- Value Characteristics to SAP BW

Web Dynpro ABAP: ALV and Table in Popup Window

ABAP Debugging Tips and Tricks

Integration of SAP R/3 with BO Universe Using Data Federator Connector

Direct Subcontracting Process (SAP SD & MM)

Sending an Image File Through XI in a File-to-Mail Scenario

SAP CRM System 6.0/7.0. For more information, visit the Customer Relationship Management homepage

Changing Partner s Address Data of the Sales Order

Display Popup Window and Dialog Box in ALV

Process Controlled Workflow SRM 7.0 (Using BRF)

Configuration of Enterprise Services using SICF and SOA Manager

Creation and Configuration of Business Partners in SAP CRM

ABAP Proxy Interfacing

Understanding OLAP Processor and RSRT

A Step-by-Step guide on SMTP Configuration and File to Mail Scenario Using Process Integration Scenario in PI 7.1

Organizational Management- Organizational Structure Creation

Web Dynpro: Multiple ALV Grids and Layouts in ALV

Transfer of Archived SAP ERP Data to SAP NetWeaver BW. Using PBS archive add ons

Step by Step Guide to Archiving and Deleting of XML Messages in SAP NetWeaver PI

SAP BW Configuration Basic System Settings

Workflow Troubleshooting and Monitoring in SAP ECC 6.0

Step by Step Procedure to Create Broadcasters, to Schedule and to Enhance of SAP- BI Queries from Query Designer

How to Integrate CRM 2007 WebClient UI with SAP NetWeaver Portal

Step by Step Guide to Fiscal Week and Fiscal Quarter

Quick Guide EDI/IDoc Interfacing to SAP ECC from External System

Transcription:

SAP BI Generic Extraction Using a Function Module Applies to: SAP BI Summary This article demonstrates a step-by-step process for doing generic extraction from R3 into BI using a Function Module. Author(s): P Renjith Kumar. Company: Pricol Technologies Created on: 14 February 2007 Author Bio P. Renjith Kumar is SAP BI Consultant with PRICOL Technologies. He has extensive crossfunctional experience and has been with end-to-end SAP implementations as an ABAP Consultant. 2007 SAP AG 1

Table of Contents R3 Side...3 Code...8 Data Source Creation...10 Checking Extraction...11 BW Side...12 Disclaimer and Liability Notice...17 2007 SAP AG 2

R3 Side 1. Create a structure with the necessary fields. The Currency and quantity fields must have reference fields also. NETWR is a currency field so it must have reference field that is in the base table. Click Currency / Quan and give that field name. 2. In transaction SE80, Select Function group, name RSAX. Right click and Copy: 2007 SAP AG 3

1 2 Give new name of function Group Select only the needed function module: 2007 SAP AG 4

Give the new function module name The Function Module in SE37 will be like this, we have to do light modification 2007 SAP AG 5

No change in Import Tab. Export, Changing No values. 2007 SAP AG 6

In TABLES tab, give the structure name. Give your structure name In Exceptions No data. In Source code Tab. Write this Code The Code that we need to write is Placed Inside 2007 SAP AG 7

Code FUNCTION ZRSAX_BIW_GET_DATA_SIMPLE4_2. *"---------------------------------------------------------------------- *"*"Local interface: * IMPORTING *" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR *" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL *" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL *" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL *" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL *" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF *" TABLES *" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL *" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL *" E_T_DATA STRUCTURE ZNVBAK1 OPTIONAL *" EXCEPTIONS *" NO_MORE_DATA *" ERROR_PASSED_TO_MESS_HANDLER *"---------------------------------------------------------------------- * Example: DataSource for table SFLIGHT TABLES: ZNVBAK1. * Auxiliary Selection criteria structure DATA: L_S_SELECT TYPE SRSC_S_SELECT. * Maximum number of lines for DB table STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE, * counter S_COUNTER_DATAPAKID LIKE SY-TABIX, * cursor S_CURSOR TYPE CURSOR. * Select ranges * RANGES: L_R_CARRID FOR SFLIGHT-CARRID, L_R_CONNID FOR SFLIGHT-CONNID. RANGES: SDNO FOR znvbak1-vbeln. * Initialization mode (first call by SAPI) or data transfer mode * (following calls)? IF I_INITFLAG = SBIWA_C_FLAG_ON. ************************************************************************ * Initialization: check input parameters * buffer input parameters * prepare data selection ************************************************************************ * Check DataSource validity CASE I_DSOURCE. WHEN 'ZFMEDS4'. WHEN OTHERS. IF 1 = 2. MESSAGE E009(R3). ENDIF. * this is a typical log call. Please write every error message like this LOG_WRITE 'E' 'R3' '009' "message type "message class "message number I_DSOURCE "message variable 1 ' '. "message variable 2 Name of Data source given in RS02 2007 SAP AG 8

RAISE ERROR_PASSED_TO_MESS_HANDLER. ENDCASE. APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT. * Fill parameter buffer for data extraction calls S_S_IF-REQUNR = I_REQUNR. S_S_IF-DSOURCE = I_DSOURCE. S_S_IF-MAXSIZE = I_MAXSIZE. * Fill field list table for an optimized select statement * (in case that there is no 1:1 relation between InfoSource fields * and database table fields this may be far from beeing trivial) APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS. ELSE. "Initialization mode or data extraction? ************************************************************************ * Data transfer: First Call OPEN CURSOR + FETCH * Following Calls FETCH only ************************************************************************ * First data package -> OPEN CURSOR IF S_COUNTER_DATAPAKID = 0. * Fill range tables BW will only pass down simple selection criteria * of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'. * LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CARRID'. * MOVE-CORRESPONDING L_S_SELECT TO L_R_CARRID. * APPEND L_R_CARRID. * ENDLOOP. * * LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CONNID'. * MOVE-CORRESPONDING L_S_SELECT TO L_R_CONNID. * APPEND L_R_CONNID. * ENDLOOP. LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'VBELN'. MOVE-CORRESPONDING L_S_SELECT TO SDNO. APPEND SDNO. ENDLOOP. * Determine number of database records to be read per FETCH statement * from input parameter I_MAXSIZE. If there is a one to one relation * between DataSource table lines and database entries, this is trivial. * In other cases, it may be impossible and some estimated value has to * be determined. OPEN CURSOR WITH HOLD S_CURSOR FOR * SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT * WHERE CARRID IN L_R_CARRID AND * CONNID IN L_R_CONNID. SELECT VBAK~VBELN VBAK~ERDAT VBAK~NETWR VBAP~MATNR VBAP~POSNR FROM VBAK INNER JOIN VBAP on VBAK~VBELN = VBAP~VBELN WHERE VBAK~VBELN IN SDNO. ENDIF. "First data package? * Fetch records into interface table. * named E_T_'Name of extract structure'. 2007 SAP AG 9

FETCH NEXT CURSOR S_CURSOR APPENDING CORRESPONDING FIELDS OF TABLE E_T_DATA PACKAGE SIZE S_S_IF-MAXSIZE. IF SY-SUBRC <> 0. CLOSE CURSOR S_CURSOR. RAISE NO_MORE_DATA. ENDIF. S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1. ENDIF. "Initialization mode or data extraction? ENDFUNCTION. Now Save, Activate the function module. Goto SE80 -> Select Function Group, Activate the Function Group. Note: If you do not activate function Group, You will not be able to create data source in RS02 Data Source Creation Then you have to create the data source, the data source name must be the name given in the source code of the Function module. RSO2 -> Create 2007 SAP AG 10

Select Extr By Fun Module, Give name of Appl comp, Function Module, Extract Structure, save Checking Extraction Now give the selection Conditions and save. RSA3 ->Give data source name and check extraction 2007 SAP AG 11

2 Give max value to get the correct value extracted BW Side. 1. RSA1 ->Source system, Src sys -> Rt Click, Data source Over view, Appl Comp, Rt click, Replicate. 2. RSA1 - > Info source - > Create Appl comp -> Rt clk, Assign Data source - > Src Sys Some Blank Value will come in Info object; just press F4 and select, same field option 2007 SAP AG 12

Then Press <- and save, Activate Data source. Then From Info area, Create Info cube, Assign the Info source name created to char and Key fig of Cube Cube will have no char in Char tab or on any other tab, Press Info source icon in Cube 2007 SAP AG 13

If you double click that info source, every char. Key fig from that info source will come automatically into cube, just assign Dimension to Cube and save and activate. Create Update Rule for the Cube based on the info source 2007 SAP AG 14

Now Schedule the Extraction The final data will be like this in Monitor 2007 SAP AG 15

2007 SAP AG 16

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document. 2007 SAP AG 17