19
Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program Applies to: SAP Netweaver™ Exchange Infrastructure SP13. For more information, visit the SOA Management homepage . Summary This article provides details on the usage of the SOAP lookup and RFC lookup along with the multi mapping in the single mapping program and explains how to fetch the data using the look up’s and creating files in their respective business system. Author: Pavan Kumar Nukala Company: Yash Technologies Created on: 31 August 2009 Author Bio Pavan Kumar Nukala is an SAP PI Consultant in Yash Technologies SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Applies to: SAP Netweaver™ Exchange Infrastructure SP13.

For more information, visit the SOA Management homepage.

Summary This article provides details on the usage of the SOAP lookup and RFC lookup along with the multi mapping in the single mapping program and explains how to fetch the data using the look up’s and creating files in their respective business system.

Author: Pavan Kumar Nukala

Company: Yash Technologies

Created on: 31 August 2009

Author Bio Pavan Kumar Nukala is an SAP PI Consultant in Yash Technologies

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1

Page 2: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Table of Contents Introduction .........................................................................................................................................................3 Structure of RFC.................................................................................................................................................4 Creation of Outbound Data Types......................................................................................................................6 Creation of Inbound Data Types.........................................................................................................................7 Creation of Message Interfaces..........................................................................................................................8 Mapping ............................................................................................................................................................10 Test the Mapping ..............................................................................................................................................12 Configurations in the Integration Directory .......................................................................................................13 Related Content................................................................................................................................................18 Disclaimer and Liability Notice..........................................................................................................................19

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 2

Page 3: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Introduction We had a requirement in which we want to send the request to the RFC in SAP system and the WEBSERVICE both at a time and the values which we retrieve from the both systems should create the separate files in their respective business system.

I tried with the different approaches and finally I come up this approach. While trying with different approaches I found that synchronous flow of messages does not support multiple receivers. Here I used the concept of Lookup’s to overcome this issue. And lookup’s helped me a lot and solve the issue very easily. And along with the lookup’s I used the concept of MULTIMAPPING.

I used the web service as Conversion Rate and created the custom RFC which has the input and output parameters. The RFC which was created in R/3 system has the functionality to take input and deliver the output.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 3

Page 4: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Structure of RFC

The above screen shows the input parameters of the RFC and the output parameter is as shown below:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 4

Page 5: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

The below screen shows the simple code to fetch the data from the custom table based on the input parameters.

Based on the web service and the RFC, create the Source data type and message types.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 5

Page 6: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Creation of Outbound Data Types

Source data type has the fields FromCurrency and ToCurrency.Create the two inbound data types, one is for the web service and the other is for the RFC with same structure having the field as ForexRate as below

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 6

Page 7: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Creation of Inbound Data Types Inbound data type for web service:

Inbound data type for the RFC.

Create one outbound message type and two inbound message types based on the above data types which were not mentioned here.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 7

Page 8: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Creation of Message Interfaces Create one outbound interface with mode as asynchronous.

Create the two inbound interfaces for RFC and web service. Inbound interface for the web service which is asynchronous.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 8

Page 9: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Inbound interface for the RFC which is asynchronous.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 9

Page 10: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Mapping Create the message mapping. While creating mapping program add the inbound message types explicitly under the message tab as shown below

After adding the outbound message type and inbound message types perform the mapping between the fields as shown below.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 10

Page 11: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

In the above screen the input fields FromCurrency and ToCurrency are mapped to the target field ForexRate which is under message type MT_IB_SoapLookup using the UDF SoapLookUp.

In the above screen the input fields FromCurrency and ToCurrency are mapped to the target field ForexRate which is under message type MT_IB_RFCLOOKUP using the UDF RFCLookup.

Configure the two receiver communication channels in the ID, one is for the SOAP adapter and the other is for the RFC adapter. Since we are using the soaplook and the rfclookup in our mapping we need to maintain the business system name and the respective communication channel names in the UDF.These communication channels will help to get the output from the RFC and web service based on the values given in the input fields in the message mapping.

Testing the message mapping. If you observe the below screen based on the input values the output got generated from the RFC and Web service. The Field ForexRate which has the value 79.4937 is coming from the web service (of course it may vary from day to day) and the ForexRate which is having the value 80 is coming from the RFC.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 11

Page 12: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Test the Mapping

Create the interface mapping between the outbound interface and the two inbound interfaces as shown below. In the inbound side add the two interfaces by using the add button.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 12

Page 13: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Configurations in the Integration Directory Create one sender communication channel with adapter type FILE and two receiver communication channels with adapter types FILE and two more receiver communication channels for RFC and SOAP as discussed above.

Create the Business systems for sender communication channel and receiver communication channels. For RFC and SOAP receiver channels use business service and for the RFC business service maintain the adapter specific identifiers.

Create the File sender communication channel and maintain the required parameters like source directory and file name, FTP parameters and the processing mode.

Create the two File receiver communication channels and maintain the required parameters which were not showed here.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 13

Page 14: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Create the SOAP receiver communication channel and maintain the target URL and soap action.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 14

Page 15: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Create the RFC receiver communication channel and maintain the details of the target R/3 system.

Create the one sender agreement for sender file adapter and two receiver agreements for the receiver file adapters and create Enhanced interface determination and one receiver determination, no need to create any receiver agreements for the RFC and SOAP communication channels. The creation of agreements was not shown here as it is quite easy.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 15

Page 16: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Create the interface determination and select the radio button enhanced and select the interface mapping.

Create the receiver determination as shown below

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 16

Page 17: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

After done with end to end configurations, test the scenario.

Our Input xml file is

After the source file has picked successfully log on to ABAP stack and hit the transaction SXMB_MONI and observe the pipeline steps. Under message mapping step under the payload you can see the two payloads as shown below. Right click on the below selected fields and open them in window one and window two.

Output files will be generated as below.

Output using SOAPLookUp:

Output using RFCLookUp:

In this document I am not giving any code for the UDF’s SOAPLOOKUP and RFCLOOKUP.Since there is no much difference in the code only thing is to change the business systems and communication channels For better understand of the code and lookup’s refer the below links.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 17

Page 18: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Related Content Please refer the below links for more information on lookup’s.

https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5001

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439&overridelayout=true

http://help.sap.com

For more information, visit the SOA Management homepage.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 18

Page 19: Usage of SOAP Lookup and RFC Lookup in a Single Mapping Program

Usage of SOAP Lookup and RFC Lookup in a Single Mapping 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 SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 19