Sunteți pe pagina 1din 9

Dynamic Call Specific R/3 Datasource Using Same Exit

Applies to:
This article is applicable for SAP BI Consultants who are accustomed with SAP ABAP Skills. For more information, visit the EDW.

Summary
This document explains to call enhanced SAP R/3 datasources using the same Exit RSAP0001 without doing any modification to the existing User-Exit code. Author: Suraj Tigga

Company: Capgemini Consulting India Pvt. Ltd. Created on: 22 July 2010

Author Bio
Suraj Tigga is a Senior SAP BI / ABAP consultant at Capgemini Consulting, India. Suraj joined Capgemini Consulting in 2008 and has worked on multiple SAP BI implementation and support projects.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

Dynamic Call Specific R/3 Datasource Using Same Exit

Table of Contents
Scenario ....................................................................................................................................................... 3 Step-by-Step Solution ................................................................................................................................ 3
User Exit Details (RSAP0001) ..................................................................................................................................... 3 Enhancement of Datasource (0CUSTOMER_ATTR)................................................................................................... 3 User Exit (ABAP Code Logic) EXIT_SAPLRSAP_002........................................................................................... 4 Function Module (ZBWF_0CUSTOMER_ATTR) ......................................................................................................... 5 Execution ..................................................................................................................................................................... 6

Related Content ............................................................................................................................................ 8 Disclaimer and Liability Notice ....................................................................................................................... 9

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

Dynamic Call Specific R/3 Datasource Using Same Exit

Scenario
Enhancement of the standard extractor should be called dynamically from the User-Exit RSAP0001 without doing any changes to the existing Use-Exit code. Step-by-Step Solution Step1: Datasource 0CUSTOMER_ATTR should be enhanced with fields SPART (Division) and PARVW (Partner Function). Step2: Function Module ZBWF_0CUSTOMER_ATTR should be called from Exit (Function Module) EXIT_SAPLRSAP_002. Step3: Logic for getting the values for SPART (Division) and PARVW (Partner Function) should be incorporated for all the customers. Document has four following sections: User Exit Details (RSAP0001): Brief about datasource enhancement exit. Enhancement of Datasource (0CUSTOMER_ATTR): Steps to enhance the standard datasource User-Exit (ABAP Code Logic) EXIT_SAPLRSAP_002: Generic code for all Datasources Function Module (ZBWF_0CUSTOMER_ATTR): Fetches the data for added fields. Execution: To execute the datasource using RSA3. User Exit Details (RSAP0001) The SAP enhancement RSAP0001 is available if you want to fill fields that you have added to the extraction structure of a DataSource as an append structure. This enhancement is made up of the following enhancement components: Function Module EXIT_SAPLRSAP_001 EXIT_SAPLRSAP_002 EXIT_SAPLRSAP_003 Enhancement of Datasource (0CUSTOMER_ATTR) Step1: Enhance the datasource 0CUSTOMER_ATTR, use transaction RSA6 Purpose Transaction Data Attributes , Text Hierarchies

Give the APPEND structure name as follows:

Add fields ZPARVW (Partner Function) and ZSPART (Division) to the append structure

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

Dynamic Call Specific R/3 Datasource Using Same Exit

Dont forget to unhide the fields. User Exit (ABAP Code Logic) EXIT_SAPLRSAP_002 Step1: Go to User Exit RSAP0001 and then to the master data function module (EXIT_SAPLRSAP_002).Write the below code as mentioned:

Call the DYNAMIC Function Module for relative Datasource

Note: All the datasources should be prefixed with ZBWF_.This is done because many developers are working on the same exit (So to reduce the risk of having this exit deactivated mistakenly, the above mentioned method should be followed).

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

Dynamic Call Specific R/3 Datasource Using Same Exit

Function Module (ZBWF_0CUSTOMER_ATTR) Below are the details of the Datasource Function Module: Step1: Import Parameters

I_DATASOURCE: Contains the datasource name I_CHABASNM: Contains the Infoobject name I_UPDMODE: Contains the Transfer Mode Step2: Tables

I_T_SELECT: Contains the selection condition I_T_FIELDS: Requested fields to populate I_T_DATA: Contains the final data (Here the structure should be same as the extract structure of the datasource) C_T_MESSAGES: Contains the error log Step3: Exceptions

Error log when calling the Customer Exit

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

Dynamic Call Specific R/3 Datasource Using Same Exit

Step4: Source Code For every customer we have to get the first value of the Partner Function (Partner Function) and SPART (Division).Find the ABAP Code pasted below:

Execution Step1: Go to transaction RSA3 and set the breakpoint in the function module to check the values for partner function and Division

DEBUG:

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

Dynamic Call Specific R/3 Datasource Using Same Exit

Above same fundamentals can be applied to the other function Modules: a) EXIT_SAPLRSAP_001 : Transaction Data b) EXIT_SAPLRSAP_003: Hierarchy

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7

Dynamic Call Specific R/3 Datasource Using Same Exit

Related Content
For more information, visit the EDW Homepage

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 8

Dynamic Call Specific R/3 Datasource Using Same Exit

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 do cument, 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 conte nt of this document.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 9

S-ar putea să vă placă și