RFC-to-Web Service Scenario

by Neeraja

This document describes how the Custom RFC client application in SAP R/3 System invokes a free Web service (that is hosted over the internet) using SAP XI. For our demo purpose, we have used a free web service available on the Internet. Details for the same are provided in the next section. 

About the web service: 

In this example scenario we will be using “GetQuote” method of Web service “DelayedStockQuote”. This method retrieves the Stock quote for the given Stock symbol. The method “GetQuote” has an input that takes in two parameters Stock Symbol and License Key and returns the following information. 

  • StockSymbol,

  • LastTradeAmount,

  • LastTradeDateTime,

  • StockChange,

  • OpenAmount,

  • DayHigh,

  • DayLow,

  • StockVolume,

  • PrevCls,

  • ChangePercent,

  • FiftyTwoWeekRange,

  • EarnPerShare,

  • PE,

  • CompanyName.

Link to webservice:


WSDL of the webservice:


        Download WSDL from the above link.     

1.      Configurations at the Sender System (SAP R/3)

1.1  Create RFC destination:
To create the RFC go to TCODE: SM59
 Create new destination of type T (TCP/IP)
 Make sure you select Registered Server Program option before writing your program ID
 Write your program ID (remember it's case-sensitive)
 In the gateway host and gateway service write the values of your "Application system" - business system (R/3 System)


1.2   Create Remote function module

Create Remote Function module in R/3 system with the following parameters.




 Source code:   

 1.3   Create Report Program

Create a report program in the R/3 system which makes Synchronous call of a remote-enabled function module ZN_GET_QUOTE. 

Code snippet


parameters: p_stsym(30).

StockSymbol type char30,
LastTradeAmount type char30,
LastTradeDateTime type char30,
StockChange type char30,
OpenAmount type char30,
DayHigh type char30,
DayLow type char30,
StockVolume type char30,
PrevCls type char30,
EarnPerShare type char30,
companyname type char30,
QuoteError type char30.

StockSymbol = StockSymbol
LastTradeAmount = LastTradeAmount
StockChange = StockChange
OpenAmount = OpenAmount
DayHigh = DayHigh
DayLow = DayLow
StockVolume = StockVolume
PrevCls = PrevCls
EarnPerShare = EarnPerShare
companyname = companyname

QUOTEERROR = QuoteError.

if quoteerror NE 'true' and quoteerror NE 'TRUE'.
/'StockVolume:',StockVolume ,
write:/ 'Invalid Stock symbol'.



Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image