Do you like this blog? Give us a like on Facebook X

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.

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.

SAP XI RFC Sender AdapterRFC 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>’.

SAP XI RFC Receiver AdapterNow, 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.

STFC_CONNECTION InputCreate 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).

STFC_CONNECTION OutputAccordingly, 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.

Comments

  1. kesava says:

    Hi,
    RFC .. PI …SOAP …. i have developed this scenario. i set the interface as a Synchronous in PI system. while push the data through function module from SAP R/3 system. in Moni it self it is showing Asynchronous. we are not getting any error. the messages are showing successful status in moni. but Synchronous is not happening.( in moni it is showing Asynchronous and Qos is EO …… it should be Synchronous and Qos is BE)
    in R/3 system, calling program is like below
    CALL FUNCTION ‘xxxxxxxx’
    IN BACKGROUND TASK
    DESTINATION ‘RFC_ARIBAPI’
    TABLES
    ZGT_xxx = LT_TAB
    CHANGING
    RETURN = RETURN.

    i have tried so many time to convert this scenario as Synchronous but i could not in PI end.
    Need help to make it this scenario as a sync.

  2. July says:

    Hi Riyaz,
    I test an asynchronous scenario soap to rfc(third-party send data to sap), soap is sender ,rfc is receiver(rfc just have one parameter is a table),and just one message interface I choosed inbound and asynchronous、one message mapping in IR,then after config chancel、determination、agreement I define a webservice in ID.
    But when call this webservice,return error: MAPPING.NO_MAPPINGPROGRAM_FOUND
    Interface mapping Object ID 7D83DAFA4B7A30CF8FCEE9A172DC7798 Software Component 57C41011EA3811E0BA65C731C0A85A0C does not exist in runtime cache
    And I saw a hint in monitor for processed XML message is:Interface mapping does not have a response mapping.
    I dont know why,can you tell me whether rfc must config response.(But I dont want response,just send data one way)
    how to slove it,I dont want response.

    PS:Actually the data from third-party send to sap is success,but return error.
    Help me,Thanks .
    -July.

    • Riyaz says:

      Make sure the sender or outbound interface is aysnchronous. The interface mapping should not show a tab for Response mapping.

  1. Zahir85678 says:

    Hi,

    I have a rfc sender system…Sometimes scenario works fine and somtimes error in sender system as “CALL FUNCTION REMOTE ERROR – Wrong Sender Agreement: The sender agreement does not have channel”. This error is random. Any help here.

    Also sender system has ABAP(type 3) connection created to XI. Is it mandatory for RFC sender system to create TCP/IP(type T) connection to XI?

    Zahir Khan

    • Riyaz says:

      Go through ‘Testing the Connectivity’ section in this article. That should help.

    • Arivarasu says:

      Hi,

      Check your Program Id and ensure that is not used in another sender RFC channel. As mentioned Program ID has to be unique.

  2. Paul says:

    Hi Riyaz,

    Thanks for the very good blog. I juast have 1 question though. Regarding the RFC call from PI. How will I know if the FM was sucessfully executed on the Target SAP Backend. Im no Abaper and rely on FM made by our abap developers. Can you help me check whether the FM was sucessfully called by PI?

    Thanks,
    Paul

  3. Abhradeep says:

    Riyaz,

    What are the steps for the below scenario:

    XI is called webservice to ecc system

  4. Samant says:

    Hi Riyaz.
    I was trying to set up using STFC_CONNECTION -> Rfc sender and receiver.
    I get System failure when I execute this FM. My connection test works fine – means the program id is registered successfully, right?
    When I try to monitor via Component monitoring, I see error that Sender agreement is not specified, even though I have specified it :(
    In the design time, I just imported the RFC FM. DId not create any operational mapping or message mapping. I thought that should be the cause. But even when I create it, in the configuration time, my Operational mapping is not coming for selection.
    Can assist me where I am going wrong?
    Thanks a ton.

  5. Sciha says:

    got it riyaz, just forgot mapping the main node before for the tables, thanks! have to align now the datas from the mainframe to RFC tables.

  6. Sciha says:

    Hi Riyaz,
    why is it that when mapping a legacy system to a SAP RFC the Export parameters of the RFC is okay and the values are passed but when I’m using Tables there is no values passed even if I’ve mapped all the fields on it, Mapping for the export and Tables are done on the response mapping since the initiator is SAP RFC

    • Riyaz says:

      I did not understand your question completely. When you use tables in RFC, the table fields are included in the export and import parameters of the RFC structure you import in PI. It is up to you to use them or not.

  7. Riyaz Sayyad says:

    Systems outside your network would act as partner systems. PI being a middleware, can receive or send messages to systems outside its network as long as there is an adapter to communicate with the systems. You need a single PI instance. Offcourse if your partner also uses PI, you can always have PI to PI communcation.

  8. Guido Koopmann says:

    Hi Guru’s

    When I want to work with RFC calls from SRM and ECC which are outside my network do I need to install 2 PI systems to achieve that?

    Best regards,

    Guido Koopmann

  9. Riyaz says:

    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.

  10. Abdur Rasheed says:

    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.

  11. Riyaz says:

    It looks like connectivity issue. You may want to test the connectivity with your remote system using “Testing the Connectivity” section in this article.

  12. Chandra says:

    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.

  13. Himanshu says:

    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.

  14. Riyaz says:

    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.

  15. Himanshu says:

    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.

  16. Riyaz says:

    Hi Milind,

    I am good. Great to hear from you.

    Thanks.

    Regards,
    Riyaz

  17. Hi Riyaz ,

    How are you ? Its really a very good blog .

    Its very helpful for me.

    Thanks
    Milind.

  18. Phani says:

    PI future is too good, before learning XI just learn XML,XSLT and XPATH … you can learn all this in w3schools.

  19. ShreeGanesh says:

    Hi Riyaz,

    I want to Learn SAP XI/PI ,Then How Its future

  20. Dennis says:

    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

  21. Kumar says:

    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.

  22. Sagar says:

    Dear,

    Thanks for your valuable comments. I think BPM Scenario would be better, rather than having different independent scenarios.

    Thanks,
    Sagar

  23. digvijay says:

    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.

  24. Sagar says:

    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

  25. Balaji says:

    Hi
    Where to learn netweaver PI online

  26. Riyaz says:

    Hey Anirban,
    Good to hear from you. Thanks for the comment.

    Riyaz

  27. Anirban Ghatak says:

    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

  28. Riyaz says:

    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.

  29. kumar says:

    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.

  30. Riyaz says:

    Also check this page.

  31. Riyaz says:

    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

  32. SAP says:

    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)

  33. Riyaz says:

    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

  34. SAP says:

    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

  35. Riyaz says:

    PI – Process Integration, from version 7.0 onwards XI is called as PI

  36. CHANDU says:

    XI/PI- WHAT IS THIS PI?