Sie sind auf Seite 1von 10

Procedure to Trigger Events in Remote System Using an ABAP Program

Applies to:
SAP BW 3.x, SAP BI 7.x, SAP ECC, APO Systems.

Summary
This document gives the procedure to trigger events in a Remote System using an ABAP Program. Author: Company: Venkata Nagarjuna Reddy Infosys Limited

Created on: 20 October 2011

Author Bio
Venkata Nagarjuna Reddy is a Technology Lead working in Infosys Limited, Nagarjuna Joined Infosys Limited in Sep 2008 and worked on various SAP BI Projects.

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

Table of Contents
Introduction ......................................................................................................................................................... 3 Scenario .............................................................................................................................................................. 3 Procedure ........................................................................................................................................................... 3 Creating a Table .............................................................................................................................................. 3 RFC Enabled Function Module ....................................................................................................................... 4 Creation of Main ABAP Program .................................................................................................................... 6 Testing through SE38 ..................................................................................................................................... 8 Related Content .................................................................................................................................................. 9 Disclaimer and Liability Notice .......................................................................................................................... 10

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

Introduction
As a part of BW Process it may be required to trigger events in Remote System (eg: BW. R/3, APO) to start a Job or a process chain. This can be achieved by an ABAP prgram which can be used to call the events in a Remote System.

Scenario
In this document an ABAP Program ZRFC_RAISE_REMOTE_EVENT is created which will call a remote event in R/3 from a BW system.

Procedure
Creating a Table 1. Go to T-Code SE11 and create a Transparent table ZRFCDETAILS with Delivery Class C with the below fields

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

2. Maintain the RFC Destination details in the table ZRFCDETAILS

RFC Enabled Function Module 1. Go to SE37 and create a FM Z_BP_EVENT_RAISE with the following import parameters.

2. Exceptions used in the Function Module.

3. Write the code as below to. FUNCTION Z_BP_EVENT_RAISE. *"---------------------------------------------------------------------*"*"Local Interface: *" *" *" *" *" *" *" IMPORTING VALUE(EVENTID) TYPE VALUE(EVENTPARM) TYPE EXCEPTIONS BAD_EVENTID EVENTID_DOES_NOT_EXIST TBTCO-EVENTID MSXXLIST-NAME DEFAULT SPACE MSXXLIST-NAME DEFAULT SPACE

VALUE(TARGET_INSTANCE) LIKE

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

*" *"

EVENTID_MISSING RAISE_FAILED

*"---------------------------------------------------------------------*"---------------------------------------------------------------------*"*"Local Interface: *" *" *" *" *" *" *" *" *" IMPORTING VALUE(EVENTID) TYPE VALUE(EVENTPARM) TYPE EXCEPTIONS BAD_EVENTID EVENTID_DOES_NOT_EXIST EVENTID_MISSING RAISE_FAILED TBTCO-EVENTID MSXXLIST-NAME DEFAULT SPACE MSXXLIST-NAME DEFAULT SPACE

VALUE(TARGET_INSTANCE) LIKE

*"---------------------------------------------------------------------CALL FUNCTION 'BP_EVENT_RAISE' EXPORTING EVENTID EVENTPARM EXCEPTIONS BAD_EVENTID EVENTID_DOES_NOT_EXIST EVENTID_MISSING RAISE_FAILED OTHERS IF SY-SUBRC <> 0. case sy-subrc. when 1. raise bad_eventid. when 2. raise EVENTID_DOES_NOT_EXIST. when 3. raise EVENTID_MISSING. when 4. raise RAISE_FAILED. when 5. raise RAISE_FAILED. endcase. ENDIF. ENDFUNCTION. = 1 = 2 = 3 = 4 = 5. = eventid = EVENTPARM

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

Creation of Main ABAP Program 1. Go to SE38 and create a Program ZRFC_RAISE_REMOTE_EVENT withe below attibutes.

2. Write below mentioned code. REPORT ZRFC_RAISE_REMOTE_EVENT. *----------------------------------------------------------------------* * Data Declarations: tables: ZRFCDETAILS. data: l_remote_sys like ZRFCDETAILS-RFCDEST. selection-screen begin of block S1 with frame. select-options: s_syrole parameters: s_evntid s_param for ZRFCDETAILS-SYSROLE no-extension no intervals. type BTCEVENTID , type BTCEVTPARM. * *----------------------------------------------------------------------*

selection-screen end of block S1. *----------------------------------------------------------------------* * Begin of processing at selection-screen. if sy-ucomm eq 'ONLI'. * *----------------------------------------------------------------------*

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

* Check that remote system can be found select from into where and and and single rfcdest ZRFCDETAILS l_remote_sys sysid zmandt sysrole eq sy-sysid eq sy-mandt eq s_syrole-low

zprimary eq 'X'.

if sy-subrc ne 0. message e016(XSS_SER) with s_syrole-low. else. * Call RFC enabled FM CALL FUNCTION 'Z_BP_EVENT_RAISE' destination l_rem_system EXPORTING EVENTID EVENTPARM * TARGET_INSTANCE EXCEPTIONS BAD_EVENTID EVENTID_DOES_NOT_EXIST EVENTID_MISSING RAISE_FAILED OTHERS CASE SY-SUBRC. WHEN '0'. message s066(1m) with s_evntid. WHEN '1' OR OR '2' '3'. message e530(sls) with s_evntid. WHEN '4' OR '5'. message e067(1m) with s_evntid. ENDCASE. endif. endif. = 1 = 2 = 3 = 4 = 5. = s_evntid = s_param = ' '

3. Maintain the Slection Texts for the Report as below.

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

Testing through SE38 Go to SE38 and execute the Program ZRFC_RAISE_REMOTE_EVENT with the below selctions.

This will trigger the event RE_OK in the Remote R/3 System RCQCLNT310

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

Related Content
EDW homepage SAP Help Documentation How to trigger the Process Chains in BW from ECC

SAP COMMUNITY NETWORK 2011 SAP AG

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

Procedure to Trigger Events in Remote System Using an ABAP Program

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.

SAP COMMUNITY NETWORK 2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com 10

Das könnte Ihnen auch gefallen