Sei sulla pagina 1di 18

RFC Mapping Lookups in Message Mappings

Applies to:
This scenario is implemented in PI 7.1 server. For more information, visit the SOA Management homepage.

Summary
In SAP NetWeaver Process Integration (PI) 7.1, there is now graphical support for JDBC and RFC mapping lookups in message mappings, instead of having to create a user-defined function with the relevant lookup code as in previous releases (e.g. XI 3.0/PI 7.0). This new feature significantly facilitates the creation of such mapping lookups and allows the PI developer to allocate his/her time to other mapping requirements.

Author:

Leela Ratnam Morampudi

Company: Satyam Computers Services Ltd Created on: 07 February, 2009

Author Bio
Leela Ratnam Morampudi is a SAP Netweaver Consultant in Satyam Computer Services Ltd.

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

Table of Contents
1. Overview .........................................................................................................................................................3 2. Prerequisites...................................................................................................................................................3 3. Data Types .....................................................................................................................................................4 4. Message Types ..............................................................................................................................................5 5. Service Interfaces ...........................................................................................................................................6 6. Message Mapping ..........................................................................................................................................7 7. Operation Mapping .......................................................................................................................................10 8. Business Component....................................................................................................................................11 9. Communication channel ...............................................................................................................................12 10. Receiver Determination ..............................................................................................................................13 11. Interface Determination ..............................................................................................................................13 12. Receiver Agreement ...................................................................................................................................14 13. Testing ........................................................................................................................................................14 Test1 .............................................................................................................................................................14
Output file:..................................................................................................................................................................15

Test2 .............................................................................................................................................................15
Output File .................................................................................................................................................................16

Related Content................................................................................................................................................17 Disclaimer and Liability Notice..........................................................................................................................18

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

1. Overview
This Document will explain you RFC mapping lookups in message mappings, instead of having to create a user-defined function This new feature significantly facilitates the creation of such mapping lookups and allows the PI developer to allocate his/her time. The Request is sent to the RFC through HTTP. Using RFC LOOK UP, the RFC is called and the response gets generated and the response from the RFC is sent to XI and from XI, it is given to file. Here both sender and receiver are asynchronous and the RFC is synchronous.

2. Prerequisites
The RFC channel to be used for the lookup must be configured and activated in the Integration Directory. The definition of the RFC structure used for the lookup must already be imported into the ES Repository as an imported archive.

Here we are going to use BAPI_MATERIAL_EXISTENCECHECK. The BAPI will take the input as the material name, and the response from the Bapi is, if it is success, it will display S, or else it will display E, and error message. Create the communication channel for the RFC Receiver. Select the adapter type as RFC. Give the R/3 System details like, Application server name, system number, logon user, password, client, language.

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

3. Data Types
Create two data types for the sender and the receiver. Create the data type for the sender.

Create data type for the receiver.

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

4. Message Types
Create 2 message types for the above data types Create message type for the sender

Create message type for the receiver

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

5. Service Interfaces
Create service interface for the sender and receiver Create sender service interface

Create receiver service interface

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

6. Message Mapping
Select the source message and target message type A message mapping parameter must be created within the Signature tab. It should be an 'Import' parameter and have Category 'Adapter' and Type 'RFC'. The name of the parameter should be the RFC receiver channel name which you have created in Integration Directory.

In mapping functions, under conversions, select RFC Lookup

Double click on RFC Lookup. You will get the below screen

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

Select the RFC which you have imported. You can the request and response message elements. Select and Double click on the request fields and response fields. Then you can get the fields which you have selected below the RFC structure.

Then you can map like as shown below

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

While testing the mapping, click on the parameters tab. You will find the below screen. Select the RFC communication channel which you have defined in the Integration Directory. Then click on Add Test Parameter Set tab and define some name for it. I have used the name as Lookup. Now save it.

Now you can test the mapping

SAP COMMUNITY NETWORK 2009 SAP AG

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

RFC Mapping Lookups in Message Mappings

7. Operation Mapping
Select the source and receiver service interfaces. Click on read operations, and then select the interface mapping. Click on the Parameters Tab

After clicking on the parameters tab, you will find the below screen. Give the RFC receiver channel name which you have created in ID, select the type as Adapter, adapter as RFC, parameter as Import.

Then now click on Binding tab. You will get the below window. Select the RFC Channel.

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 10

RFC Mapping Lookups in Message Mappings

Now activate all the objects which you have created in Integration Repository. IR part completed.

8. Business Component
Create business component and select the sender and receiver service interface.

As we are using HTTP as sender side, there is no need of sender communication channel and sender agreement.

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 11

RFC Mapping Lookups in Message Mappings

9. Communication channel
Create the receiver communication for file

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 12

RFC Mapping Lookups in Message Mappings

10. Receiver Determination


Create the receiver determination

11. Interface Determination


Create interface determination. In interface determination, select the corresponding mapping which you have defined in Integration repository. And also select the receiver channel of RFC as shown below.

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 13

RFC Mapping Lookups in Message Mappings

12. Receiver Agreement


Create receiver agreement for the receiver

Now activate all the objects which you have created

13. Testing
Give the details in the HTTP request as shown below and click on send. You will get the message as message accepted
Test1

Message in SXMB_MONI

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 14

RFC Mapping Lookups in Message Mappings

Output file:

Test2

Message in SXMB_MONI

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 15

RFC Mapping Lookups in Message Mappings

Output File

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 16

RFC Mapping Lookups in Message Mappings

Related Content
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/8661 For more information, visit the SOA Management homepage.

SAP COMMUNITY NETWORK 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 17

RFC Mapping Lookups in Message Mappings

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 2009 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com 18