fetching data directly from ecc system in bex query using rri

11
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1 Fetching Data Directly from ECC System in BEX Query using RRI Applies to: SAP BIW 3.5 and BI7.0. For more information, visit the Business Intelligence homepage . Summary This Document provides step by step solution “How to fetch data from ECC System Directly in Bex Query using RRI” using real time example with all relevant details. Author: Vipul Goyal Company: Accenture Services Ltd. Created on: 17 Sep 2009 Author Bio Vipul Goyal is working as SAP BI Consultant in Accenture Services Private Ltd and having Extensive experience in implementation of BI projects specializing in HR/SCM areas.

Upload: waiting4add

Post on 21-Feb-2015

210 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Fetching Data Directly From ECC System in BEX Query Using RRI

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

© 2009 SAP AG 1

Fetching Data Directly from ECC

System in BEX Query using RRI

Applies to:

SAP BIW 3.5 and BI7.0. For more information, visit the Business Intelligence homepage.

Summary

This Document provides step by step solution “How to fetch data from ECC System Directly in Bex Query using RRI” using real time example with all relevant details.

Author: Vipul Goyal

Company: Accenture Services Ltd.

Created on: 17 Sep 2009

Author Bio

Vipul Goyal is working as SAP BI Consultant in Accenture Services Private Ltd and having Extensive experience in implementation of BI projects specializing in HR/SCM areas.

Page 2: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 2

Table of Contents

Purpose ............................................................................................................................................................... 3

Features .............................................................................................................................................................. 3

Assumptions ....................................................................................................................................................... 3

The Step By Step Solution .................................................................................................................................. 4

Output Demo: ..................................................................................................................................................... 9

Related Content ................................................................................................................................................ 10

Disclaimer and Liability Notice .......................................................................................................................... 11

Page 3: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 3

Purpose

This Content provides a robust functionality that enables the end user to execute any remote application without actually logging into remote system. The Advanced applications that this content helps to achieve are:

1. To display data from R/3 (or any SAP system) system at BW side based on the report value.

2. End user should be able to fetch the data from R/3 (or any SAP system) for display based on the ABAP report (developed in BW) without actually logging in the R/3 system.

3. At query level, any large volume of data that physically can’t be extracted and stored to BW side can be fetched at runtime.

Features

RFC connection is set up between BW system and R/3 (or any SAP system) system through an ABAP program written at BW-side in SE-38 and data is fetched at runtime during query execution.

Assumptions

Reader is aware of following things; 1. Basic understanding of RFC fundamentals. 2. ABAP experience and know how to make custom function modules. 3. RRI functionalityProcess Plan

The example explained here gives the insight into “ how to fetch data from R/3 system at runtime for any characteristic result in Query Output”. In brief, course summary, are fetched from R/3 system for Course Id present in Query output through A RRI. The following steps explain the process:

Create an ABAP program YTEST_RFC (or any custom defined name) in se-38..

This code can be used to fetch data from R/3 system at runtime, for any characteristic value in Query Output through RRI (or in start routine, in update rules for any object).

Create a RRI on query to jump to the Local ABAP program (YTEST_RFC).

In the program call a remote function module (ZFM_REMOTE_SYSTEM) by passing Course and CourseType as parameters. (Check the below ABAP code to know how to call remote function module).

The function module gives back Course Description and comments, Link and Url Details for that Material.

Page 4: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 4

The Step By Step Solution

1. Create a RRI. Goto Transaction (RSBBS) . You reach the Sender/Receiver Assignment Maintenance screen shown below.

Select the query from which you want to jump from, to the target.

2. Choose Create. You reach the Maintain Sender/Receiver Assignment dialog box.

Then Choose a Report Type as ABAP Report and enter report name you want to call.(See step 4 to see sample program)

3. Choose Assignment Details. The Field Assignments dialog box appears.

It will display all the fields those are being used in our query. So from the list that appears; select the fields you want to transfer to the target report.

In this case Course is being passed and make sure it is passed as parameter in selection type as shown below:

Make type as delete for all others

Page 5: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 5

4. Create an ABAP program YTEST_RFC (or any custom defined name) in se-38.This program can be used to fetch data from R/3 system at runtime, for any characteristic value in Query Output through RRI

In the program call a remote function module (ZFM_REMOTE_SYSTEM) with fields that are being selected above in STEP 2 as parameters. (Check the below ABAP code to know how to call remote function module).

CODE TO MAKE AN RFC CALL TO REMOTE FUNCTION MODULE( ZFM_REMOTE_SYSTEM )

*&---------------------------------------------------------------------*

*& Report YTEST_RFC

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT YTEST_RFC LINE-COUNT 65(8) LINE-SIZE 132.

TABLES:/BI0/PTRAINING.

*TO GET VALUES PASSED FROM REPORT INTO LOCAL PARAMETERS(LT_PARAM FOR COURSE AND

LT_CTYPE FOR COURSE TYPE)*

*Choose number of parameters depending upon number of field values sent from report(

Here it is two)*

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: LT_PARAM TYPE /BI0/PTRAINING-TRAINING NO-DISPLAY,

LT_CTYPE TYPE /BI0/PTRAINING-TRAINOTYPE NO-DISPLAY .

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN SKIP.

data:E_TXTLINE TYPE STRING,

E_LINK TYPE STRING,

Page 6: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 6

E_URL TYPE STRING.

CALL FUNCTION 'ZFM_REMOTE_SYSTEM' “CALL TO REMOTE FUCTION MODULE.

destination 'sh_remtote' “TARGET SYSTEM(R/3 SYSTEM)

*Input values to the funtion

EXPORTING

i_objid = LT_PARAM

i_otype = LT_CTYPE

*Output after execution of FM at remote system

IMPORTING

E_TXTLINE = E_TXTLINE “Course Description and comments

E_LINK = E_LINK

E_URL = E_URL

EXCEPTIONS

SYSTEM_FAILURE = 1

COMMUNICATION_FAILURE = 2.

write: 'Report Starts For', LT_PARAM.

if e_txtline is initial.

write: / 'no comments availiable'.

else.

WRITE: / E_TXTLINE.

ENDIF.

WRITE: /,/ 'Link:', E_LINK,

/,/ 'URL:',E_URL.

CLEAR E_TXTLINE.

WRITE:/,/ ' Report Ends'.

5. Now in the remote system(or R/3 source system) create a remote function module

ZFM_REMOTE_SYSTEM.

6. Select the same import parameters as being passed from ABAP program above and make settings as shown in screen shot below:

Write name of function module to be called.

heresystem

Write name of remote system here.

Page 7: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 7

7. Select the exprot parameters:

8. Select the tables if you are using any as below:

Here is the sample code:

FUNCTION ZFM_REMOTE_SYSTEM.

*"----------------------------------------------------------------------

*"*"Local Interface:

*" IMPORTING

*" VALUE(I_OBJID) TYPE HRP1002-OBJID

*" VALUE(I_OTYPE) TYPE HRP1002-OTYPE

*" EXPORTING

*" VALUE(E_LINK) TYPE STRING

*" TABLES

*" E_CCOMMENTS STRUCTURE HRT1002

*" E_URL_DETAILS STRUCTURE HRT1061

types: begin of l_itype,

l_course type hrp1002-objid,

l_tabnm type hrp1002-tabnr,

l_txtline type string,

end of l_itype.

DATA: l_txtline1 type string.

data : i_tab1 type standard table of l_itype with header line.

data: i_tab2 type standard table of hrp1002 with header line,

l_tabnr like hrp1061-tabnr.

clear itab2.

select * from hrp1002 into table i_tab2

where PLVAR = '01'

and OTYPE = I_OTYPE

and objid = I_OBJID.

SELECT *

FROM hrt1002

INTO TABLE E_CCOMMENTS

FOR ALL ENTRIES IN i_tab2

WHERE ( tabnr = i_tab2-tabnr ).

clear E_LINK.

Page 8: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 8

clear l_tabnr.

select single linktxt tabnr

from hrp1061

into (E_LINK,l_tabnr)

where

PLVAR = '01' and

OTYPE = I_OTYPE and

OBJID = I_OBJID.

select * into table E_URL_DETAILS

from hrt1061

where tabnr = l_tabnr.

ENDFUNCTION.

Page 9: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 9

Output Demo:

Below is report output from where get details about the ID selected directly from R/3 system by clicking on the particular ID.

Following is window that will open while double clicking on the id seleted giving all the details for the id as shown:

Page 10: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 10

Related Content

1. Whenever remote function call is made, the remote system asks for user id or password before login to the system. Now suppose the end user don’t have the access or wants to avoid this Login, BW system should be made trusted system with Remote system (Transaction-SM59). Please follow this link for more details on it:

http://help.sap.com/saphelp_nw04/helpdata/en/22/042671488911d189490000e829fbbd/frameset.htm

2. The above code is basically developed for RRI, but the same can be used in VirtualProviders with Function Modules. In the Function Module for the Remote Cube you can write this code. Please follow this link for more details:

VirtualProviders with Function Modules

3. For more details on RRI and various Features of RRI please go the Below Link

Report-Report Interface

4. For more information, visit the Business Intelligence homepage.

Page 11: Fetching Data Directly From ECC System in BEX Query Using RRI

Fetching Data Directly from ECC System in BEX Query using RRI

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

© 2009 SAP AG 11

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.