Real Time Exchange Rate with Real Time Data Using Yahoo Finance API

Yahoo Finance API

In the earlier posts Google Map API in SAP and GPS like tool in SAP we saw how we can leverage the Google Map APIs and consume them in SAP. In this post, we extend the usage of similar APIs to track the exchange rate real time. By the real time we mean, it would be refreshed automatically at a fixed interval of time which we set and it would show the actual rate at that fraction of the time. Why always Google, this time we would use Yahoo’s API. 🙂

Yahoo Finance API:

This, Yahoo’s Finance API has the below structure.

Yahoo and SAP

We need to consume it in SAP to display the exchange rate real time and also refresh it automatically without the need to hit the REFRESH button on the screen. Won’t it be cool, if you are in a Finance Organization and you project the exchange rate or stock value on a huge wall from SAP and it gets refreshed real time for every passerby to view?

Let us see what our Application can do.

Provide the time interval at which you want the results to be refreshed.

Yahoo API

The output is displayed for a particular time.

ALV Display

Now, it is refreshed automatically. The message shows the time at which the data was refreshed.


Please note, there is no refresh button on the screen. Our Application handles the refresh.

There is no rocket science. Class Method CL_GUI_ALV_GRID->REFRESH_TABLE_DISPLAY is doing our job. 🙂

A special mention of the Class/Interface CL_GUI_TIMER and Event FINISHED is also needed.

Check the METHOD TIMER_EVENT in the Class CL_AUTO in the code.

Conceptually, what is happening?

Event FINISHED of class CL_GUI_TIMER is raised after the Timer has waited for the Interval provided in the selection screen. A listener method for FINISHED event is created and the REFRESH logic is implemented.

Another important step is to call the RUN method of CL_GUI_TIMER after the REFRESH to activate the time again.

This article is an outcome of research done to find a way to track and trace the vehicle of service providers like Ola or Uber etc. The idea was to make use of the interface/program which we created earlier where we consumed Google Map APIs. But unfortunately, we could not figure out any free APIs which would return the exact position of the vehicles real time. But we ended up finding this API which returned real time stock and exchange rate. 😛

The steps to consume the API is exactly the same as our previous articles. Therefore, we have not described them again here. If you have confusion, please refer to our earlier articles or just put breakpoints in the code and start debugging. The logic is straightforward.

If you want to get such useful articles directly to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.

If you liked this post, please hit the share buttons and like us on facebook.

Do you have anything to add to this article? Have you faced any issue using Adobe Forms? Do you want to share any real project requirement or solutions? Please do not hold back. Please leave your thoughts in the comment section.

Thank you very much for your time!!

About the author: Kuldeep Joshi

Kuldeep is an Electronics Engineer graduate. He has more than 7 years of experience in SAP with specialization in ABAP. He is an ex-IBMer who also has good working experience in SAP BI BPC.

Find more about him on LinkedIn.

We have defined a structure ‘ZAUTO_EXC’ for the below application. You might need this as well.

Exchange Rate in SAP

The complete working code snippet for this topic. Please replicate it in your SAP environment and have fun.

User Tutorial in SAPYard

1. ABAP for SAP HANA Tutorials
2. ABAP Web Dynpro Tutorials
3. GOS Tutorial
4. OOPs ABAP Tutorial
5. HANA Tutorial
6. SAP Netweaver and OData Tutorial
7. SAP Adobe Form Tutorial
8. SAP Fiori Tutorial
9. SAPUI5 Tutorial


  1. Hi Kuldeep,

    My heartfelt appreciations on this article.

    I tried creating a similar report with another URL of stock data. The URL returns an array of arrays when I checked it through UI5 application(I used ‘jsonp’ as callback type). When I tried this report with the same URL it is throwing ‘HTTP Communication Failure’. I observed in debugging mode, the “get_data_ex( EXPORTING ip_content = lv_content ).” in view- VAR_HTML HTML Browser returning 404 connection refused page(open the lv_content and change the view from the DetailDisplay tab).

    Is there any additional connection settings to be maintained? What are the pre-requisites of calling such URLs?


Please enter your comment!
Please enter your name here