dynamic call specific r_3 datasource using same exit

9
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com © 2010 SAP AG 1 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.

Upload: raju221756843567682

Post on 14-Apr-2015

18 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Dynamic Call Specific R_3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 1

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.

Page 2: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 2

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

Page 3: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 3

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 Purpose

EXIT_SAPLRSAP_001 Transaction Data

EXIT_SAPLRSAP_002 Attributes , Text

EXIT_SAPLRSAP_003 Hierarchies

Enhancement of Datasource (0CUSTOMER_ATTR)

Step1: Enhance the datasource 0CUSTOMER_ATTR, use transaction RSA6

Give the APPEND structure name as follows:

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

Page 4: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 4

Don’t 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:

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).

Call the DYNAMIC Function

Module for relative Datasource

Page 5: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 5

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

Page 6: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 6

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:

Page 7: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 7

Above same fundamentals can be applied to the other function Modules:

a) EXIT_SAPLRSAP_001 : Transaction Data

b) EXIT_SAPLRSAP_003: Hierarchy

Page 8: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 8

Related Content

For more information, visit the EDW Homepage

Page 9: Dynamic Call Specific R_3 Datasource Using Same Exit

Dynamic Call Specific R/3 Datasource Using Same Exit

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

© 2010 SAP AG 9

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.