Real-time data and exchange rates using Yahoo Finance API

We learned how to use and access the Google Map APIs within SAP. We expand on using comparable APIs to track the exchange rate in real time in this post. When we refer to “real time,” we mean that it would automatically update at a predetermined interval of time and display the current rate at that point in time. This time, instead of using Google, we would use Yahoo’s API.

Yahoo Finance REST API:
This Yahoo Finance API is structured as follows.

Yahoo and SAP

In order to display the exchange rate in real time and to automatically refresh it without requiring us to click the REFRESH button on the screen, we must consume it in SAP. Wouldn’t it be awesome to project the stock value or exchange rate from SAP onto a large wall in a finance organization, where it would be updated in real time for everyone to see?

See what our application is capable of.

Indicate the duration for which you would like the results to be updated.

The output is shown for a specific amount of time.

Note that the screen does not include a refresh button. The refresh is managed by our application.

It’s not rocket science. Our task is being completed by Class Method CL_GUI_ALV_GRID->REFRESH_TABLE_DISPLAY.

It is also necessary to give special attention to the Class/Interface CL_GUI_TIMER and Event FINISHED.

Examine the METHOD TIMER_EVENT in the code’s Class CL_AUTO.

METHODS :display_report,
* Define event handling method for event FINISHED of class CL_GUI_TIMER.
timer_event FOR EVENT finished OF cl_gui_timer.

In terms of concepts, what is going on?

The Timer waits for the Interval specified in the selection screen, at which point the Event FINISHED of class CL_GUI_TIMER is raised. The REFRESH logic is put into practice and a listener method for the FINISHED event is established.

Calling CL GUI Timer’s RUN function after REFRESH is a crucial step in reactivating the time.

METHOD timer_event .

DATA: lv_time TYPE char10.

* Get Data
me->get_data( ) .

IF me->ob_grid IS INITIAL .

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ob_grid.
ELSE.

* Refresh the ALV
CALL METHOD ob_grid->refresh_table_display.

ENDIF.

WRITE sy-uzeit TO lv_time USING EDIT MASK '__:__:__'.

CONCATENATE 'Screen refreshed at' lv_time INTO DATA(lv_msg) SEPARATED BY space.

MESSAGE lv_msg TYPE 'S' . " Get the cuuent timE as message

* Call RUN method of CL_GUI_TIMER again to activate timer
me->ob_timer->run( ) .

ENDMETHOD.

This post is the result of study into how to follow and trace the car of service providers such as Uber, Ola, and so forth. The objective was to make use of the interface/program which we established earlier when we consumed Google Map APIs. Sadly, we were unable to locate any open APIs that could provide the precise location of the cars in real time. However, we eventually came over this API that provided real-time stock and currency rate information. 

As a result, we haven’t gone over them again here. Please read through our previous articles if you’re still unclear, or just insert breakpoints into the code and begin debugging. The reasoning is simple.

What more would you like to add to this article? Have you had any problems using Adobe Forms? Would you like to share any actual project specifications or solutions?Do not hesitate to speak up.Kindly share your opinions in the space provided for comments.

I sincerely appreciate your time!


YOU MAY LIKE THIS

ABAP on SAP HANA. Part III. Debugging in ADT

Power of Parallel Cursor in SAP ABAP

OData in SAP ABAP: Streamlining Data Exchange and Integration

Source link

  • Related Posts

    Upgrade SAPUI5-14: Utilizing SAPUI5, Create an e-Signature Pad

    Today, we will learn how to develop an e-signature pad in order to capture customer signatures in a SAPUI5 app, just as promised. To gather ideas, you don’t have to…

    Important Tables with SAP FI

    Financial Accounting Table Name           Description                           Important Fields Financial Accounting FBAS             Financial Accounting “Basis”BKPF             Accounting Document Header              BUKRS / BELNR / GJAHRBSEG             Accounting Document Segment             BUKRS / BELNR / GJAHR /…

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    Upgrade SAPUI5-14: Utilizing SAPUI5, Create an e-Signature Pad

    • By Varad
    • February 23, 2025
    • 18 views
    Upgrade SAPUI5-14: Utilizing SAPUI5, Create an e-Signature Pad

    Important Tables with SAP FI

    • By Varad
    • February 22, 2025
    • 18 views
    Important Tables with SAP FI

    Table of Great Significance in SAP AA (Asset Accounting)

    • By Varad
    • February 21, 2025
    • 26 views
    Table of Great Significance in SAP AA (Asset Accounting)

    How Can UI5 Apps Be Deployed Without LPD_CUST?

    • By Varad
    • February 20, 2025
    • 40 views
    How Can UI5 Apps Be Deployed Without LPD_CUST?

    SAPUI5: Fundamental Factory Functions for Freshmen

    • By Varad
    • February 19, 2025
    • 51 views
    SAPUI5: Fundamental Factory Functions for Freshmen

    Utilizing the Formatter Function in SAPUI5

    • By Varad
    • February 18, 2025
    • 43 views
    Utilizing the Formatter Function in SAPUI5