XI/PI: Understanding the RFC Adapter
SAP XI provides different ways for SAP systems to communicate via SAP XI. You have three options namely IDoc Adapters, RFC Adapters and Proxies. In one of the earlier posts that spoke about your first XI scenario, we learned configuring the IDoc receiver adapter. And in the coming articles, I shall throw light on different adapters. This article specifically deals with understanding basics of RFC adapter on sender and the receiver side.
RFC Adapter converts the incoming RFC calls to XML and XML messages to outgoing RFC calls. We can have both synchronous (sRFC) and asynchronous (tRFC) communication with SAP systems. The former works with Best Effort QoS (Quality of Service) while the later by Exactly Once (EO).
Unlike IDoc adapter, RFC Adapter is installed on the J2EE Adapter Engine and can be monitored via Adapter Monitoring and Communication Channel Monitoring in the Runtime Workbench.
Now let us understand the configuration needed to set up RFC communication.
RFC Sender Adapter
In this case, Sender SAP system requests XI Integration Engine to process RFC calls. This could either be synchronous or asynchronous.
On the source SAP system, go to transaction SM59 and create a new RFC connection of type ‘T’ (TCP/IP Connection). On the Technical Settings tab, select “Registered Server Program” radio button and specify an arbitrary Program ID. Note that the same program ID must be specified in the configuration of the sender adapter communication channel. Also note that this program ID is case-sensitive.
When using the RFC call in your ABAP program you should specify the RFC destination created above. For example,
CALL FUNCTION ‘<NAME_OF_THE_RFC_FUNCTION_MODULE>’
DESTINATION ‘<RFC_DESTINATION_NAME>’.
Also, in case you are setting up asynchronous interface, the RFC should be called in the background. For example,
CALL FUNCTION ‘<NAME_OF_THE_RFC_FUNCTION_MODULE>’
IN BACKGROUND TASK
DESTINATION ‘<RFC_DESTINATION_NAME>’.
Now, create the relevant communication channel in the XI Integration Directory. Select the Adapter Type as RFC Sender (Please see the figure above). Specify the Application server and Gateway service of the sender SAP system. Specify the program ID. Specify exactly the same program ID that you provided while creating the RFC destination in SAP system. Note that this program ID is case-sensitive. Provide Application server details and logon credentials in the RFC metadata repository parameter. Save and activate the channel. Note that the RFC definition that you import in the Integration Repository is used only at design time. At runtime, XI loads the metadata from the sender SAP system by using the credentials provided here.
RFC Receiver Adapter
In this case, XI sends the data in the RFC format (after conversion from XML format by the receiver adapter) to the target system where the RFC is executed.
Configuring the receiver adapter is even simpler. Create a communication channel in ID of type RFC Receiver (Please see the figure above on the left). Specify the RFC Client parameters like the Application server details, logon credentials etc and activate the channel.
Testing the Connectivity
Sometimes, especially when new SAP environments are setup, you may want to test their RFC connectivity to SAP XI before you create your actual RFC based interfaces/scenarios. There is a quick and easy way to accomplish this.
Create a RFC destination of type ‘T’ in the SAP system as described previously. Then, go to XI Integration Repository and import the RFC Function Module STFC_CONNECTION from the SAP system. Activate your change list.
Configure sender and receiver communication channels in ID by specifying the relevant parameters of the SAP system as discussed previously. Remember that the Program ID in sender communication channel and RFC destination in SAP system must match (case-sensitive).
Accordingly, complete the remaining ID configuration objects like Sender Agreement, Receiver Determination, Interface Determination and Receiver Agreement. No Interface mapping is necessary. Activate your change list.
Now, go back to the SAP system and execute the function module STFC_CONNECTION using transaction SE37. Specify the above RFC destination in ‘RFC target sys’ input box. You can specify any arbitrary input as REQUTEXT. If everything works fine, you should receive the same text as a response. You can also see two corresponding messages in SXMB_MONI transaction in SAP XI. This verifies the connection between SAP system and SAP XI.



CHANDU says:
May 28th, 2008 at 8:10 pm
XI/PI- WHAT IS THIS PI?
Riyaz says:
May 28th, 2008 at 8:19 pm
PI - Process Integration, from version 7.0 onwards XI is called as PI
SAP says:
July 22nd, 2008 at 5:34 pm
after creating RFC destination (type - T) on click of connection test ,I am getting following error
Logon Connection Error
Error Details Error when opening an RFC connection
Error Details ERROR: program Z_WEBSERVICE_TEST not registered
Error Details LOCATION: SAP-Gateway on host sreccdev / sapgw02
Error Details DETAIL: TP Z_WEBSERVICE_TEST not registered
Error Details COMPONENT: SAP-Gateway
Error Details COUNTER: 19631
Error Details MODULE: gwr3cpic.c
Error Details LINE: 1778
Error Details RETURN CODE: 679
Error Details SUBRC: 0
Error Details RELEASE: 700
Error Details TIME: Tue Jul 22 17:22:41 2008
Error Details VERSION: 2
Riyaz says:
July 23rd, 2008 at 9:27 am
Hi,
You will need to use the same program ID on both ABAP and Java side i.e. in your source system in SM59 if you specify Z_WEBSERVICE_TEST, you should specify the same name in the RFC Communication channel in XI system. Note that program ID is case sensitive.
Hope this helps.
Regards,
Riyaz
SAP says:
July 23rd, 2008 at 4:36 pm
Hi, that problem was resolved, all configurations were done, connection test is ok
but at the time of RFC running it is giving error ;
“lookup of alternativeServiceIdentifier via CPA-cache failed for channel ”
I had gone through all the SDN threads, all the settings are ok
e.g. 1) web as ABAP system 2) Adapter specific identifier …..etc.
pl. suggest,
(one more thing - does my Adapter specific identifier in ID shows the same client where my RFC resides i.e. R/3 dev. client)
Riyaz says:
July 23rd, 2008 at 4:46 pm
Hi,
Check if you are using the same program ID in multiple scenarios. Maybe is you keep different the program ID names in different RFC adapters, it should resolve the error.
Regards,
Riyaz
Riyaz says:
July 23rd, 2008 at 4:47 pm
Also check this page.
kumar says:
August 19th, 2008 at 9:15 am
Hi ,
I am working on a File to RFC scenario. NO response is required from RFC .
Please , explain how to achieve this without going for BPM.
Riyaz says:
August 19th, 2008 at 4:02 pm
Hi Kumar,
You can proceed the same way as explained here. Only thing is create asynchronous scenario. dont map the response from BAPI function module.
Anirban Ghatak says:
January 1st, 2009 at 3:27 pm
Hi Riyaz,
This was a classic blog and infact it really solved my problem of checking CRM– PI connections and sender adapter.
Can you make the line in bold where you say that RFC destination and Program id would be same name ..thats the main catch…Also when we make the RFC the gateway details should be of the sender system/ Business system…
Good work!!
Anirban
Riyaz says:
January 6th, 2009 at 7:00 am
Hey Anirban,
Good to hear from you. Thanks for the comment.
Riyaz
Balaji says:
February 2nd, 2009 at 2:28 pm
Hi
Where to learn netweaver PI online
Sagar says:
February 16th, 2009 at 12:22 pm
Hi,
Thanks for your such a good blog.
I have a scenario where After successful finish of one process(FIle to JDBC) i want to execute another process(RFC to JDBC), on unsuccessful some error handling mechanism.
I dont know which is the best way to go for such scenarios. Kindly suggest me something.
Thanks.
Sagar
digvijay says:
February 18th, 2009 at 8:52 am
Hi Sagar,
You can proceed two ways
1) use BPM and config the stuff you required in BPM
2) use two asynch scenario file to jdbc and rfc to jdbc and schedule the rfc time with respect to business requirement and put jdbc look up to check weather data inserted by file to jdbc is there or not.
Sagar says:
February 19th, 2009 at 11:38 am
Dear,
Thanks for your valuable comments. I think BPM Scenario would be better, rather than having different independent scenarios.
Thanks,
Sagar
Kumar says:
March 3rd, 2009 at 8:40 pm
Hi Riyaz,
I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
Result contains following values.
return code as ( 0 Or 1) and also specific exception message if its return code is 1.
Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
Dennis says:
March 3rd, 2009 at 11:22 pm
Greetings Riyaz,
I have a simple scenario. When a file arrives to the ‘IN’ folder and
after the file is mapped and moved to an ‘OUT” folder I would like
to call a function module with export parameters on the receiver side. The recevier side is an ECC6 SAP installation. In the RFC adaptor, the ‘program’ field seems to refer to a program that resides on the server, not an ABAP program inside ECC6
SAP. Can you suggest how I perform my ‘call function’?
Thanks! Dennis
ShreeGanesh says:
April 3rd, 2009 at 2:20 pm
Hi Riyaz,
I want to Learn SAP XI/PI ,Then How Its future
Phani says:
April 7th, 2009 at 3:39 pm
PI future is too good, before learning XI just learn XML,XSLT and XPATH … you can learn all this in w3schools.
Milind Nikumbh says:
April 22nd, 2009 at 12:41 pm
Hi Riyaz ,
How are you ? Its really a very good blog .
Its very helpful for me.
Thanks
Milind.
Riyaz says:
April 22nd, 2009 at 1:00 pm
Hi Milind,
I am good. Great to hear from you.
Thanks.
Regards,
Riyaz
Himanshu says:
June 12th, 2009 at 4:38 pm
Hi,
We are facing some problem with RFC connection between sender (sap ECC 6) and sap XI.
due to some network issue on sender side TCP/IP connection sm59 on sender side shows error.
when we stop and start our sender RFC channel the problem solves.There is no error in program id,we are using correct program id.
Is recycling sender channel the only option to solve the issue? if yes how exactly it helps in re-establishing the connection?
Thanks in advance.
Riyaz says:
June 12th, 2009 at 5:40 pm
Himanshu, try restarting (Stop and Start) the services corresponding to RFC adapter via Visual Administrator. This might resolve the issue.
You may want to go through ‘Testing the Connectivity’ section in this article to make sure the connectivty is setup correctly.
Let me know if this helps.
Himanshu says:
June 12th, 2009 at 10:13 pm
Hi Riyaz,
Thx for quick reply.
Actually the connection works fine most of the time and sender cc processes messages.Problem arises when there is some maintenance/network issue on sender side.After maintenance or solving the network issue when they check at sm59 it shows connection error with below error.
Logon Connection Error
Error Details Error when opening an RFC connection
Error Details ERROR: program abc not registered
Error Details LOCATION: SAP-Gateway on host sreccdev / sapgw02
Error Details DETAIL: TP abc not registered
Error Details COMPONENT: SAP-Gateway
Error Details COUNTER: 19631
Error Details MODULE: gwr3cpic.c
Error Details LINE: 1778
Error Details RETURN CODE: 679
Error Details SUBRC: 0
Error Details RELEASE: 700
Error Details TIME: Tue Jul 22 17:22:41 2008
Error Details VERSION: 2.
We (xi) do not know about broken connection.When sender inform then we restart the sender cc and issue solves.
pl help to understand the exact cause.
Chandra says:
June 24th, 2009 at 10:23 am
I am doing file to RFC senario. I am getting this error,
Adapter Framework caught exception: error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: functiontemplate from repository was
2009-06-23 23:04:49 Error Delivering the message to the application using connection RFC_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException:
functiontemplate from repository was .
Please advice.
Riyaz says:
June 24th, 2009 at 4:17 pm
It looks like connectivity issue. You may want to test the connectivity with your remote system using “Testing the Connectivity” section in this article.
Abdur Rasheed says:
November 26th, 2009 at 8:43 pm
Hi Riyaz,
I am getting the following error adapter.
Error: com.sap.engine.interfaces.messaging.api.exception.MessagingException: XIServer:MSGGUID_EXISTING
I am using sender file adapter along request response bean module.
Could you please provide some explanation about this error.
Also, Could you please help me to understand how Message ID is created. What is mean by message key.
Riyaz says:
November 27th, 2009 at 12:56 pm
Hi Abdur Rasheed,
Following SAP notes should address the issue you are facing: 1101737 or 1272854.
PS: For questions not related to the above article, please make use of forums. Posting in forums might help you get answers faster.