G-YWWN0NYSS1 SAP GPS-like tool with Google Map API - TECHNICAL GYAN GURU SAP GPS-like tool with Google Map API - TECHNICAL GYAN GURU

SAP GPS-like tool with Google Map API

We learned how to use the Google Map API to obtain the latitude and longitude of any address. To supplement that knowledge, we would discover how to calculate the distance between two addresses in this post. Additionally, we would examine how to determine the turn-by-turn directions between two provided addresses. We would also launch a SAP browser and plot the path between two locations on a map to increase the pleasure.

Is this fascinating, in your opinion? 🙂

In a nutshell, this tool would work in SAP much like a GPS, allowing you to get coordinates (Latitudes/Longitudes), a route, and a map with comprehensive directions.

The first radio button: Distance & Coordinates

We get the Coordinates of two addresses and also the distance between them.

II.  Second Radio button: Turn by turn route

You would receive a comprehensive breakdown of the route from the source to the destination address from the tool. If accessible, it would also give you several paths.

II. Let’s select the “Display Map” radio button, which is the third one.

This GPS Tool would show the map and the routes in a web browser as asked. Look into this.

Google Map

Did you find it enjoyable?

You can try it out for yourself by using the code snippet that is provided at the conclusion of this post. This code would function just the way it is.

We must make three API calls in order to get the three output options. As previously mentioned, in order to finish the API URL and obtain the XML data, we concatenate the strings with the source and destination addresses, latitudes, longitudes, etc. We already know the trick: scanning the XML data and identifying the information that is required.

a) Coordinate GeoCode API String:

* Prepare the url of the GeoCode API
  CONCATENATE
    'http://maps.google.com/maps/api/geocode/xml?address='
    lv_address
    INTO lv_http_url .

b) Distance Matrix API String for retrieving the distance between Coordinates:

* Prepare the url for the DistanceMatrix API using From Address Coordinates and To Address Coordinates
  CONCATENATE
    'http://maps.googleapis.com/maps/api/distancematrix/xml?origins='
    <fs_dest>-place_f '|' <fs_dest>-lat_f ',' <fs_dest>-lng_f ','
    '&destinations=' <fs_dest>-place_t '|' <fs_dest>-lat_t ',' <fs_dest>-lng_t
    '&alternatives=' 'true'
    INTO lv_http_url .

c) Directions API String to trace the route on the Map:

* Prepare the url for Directions API for the From Address Coordinates and To Address Coordinates
  CONCATENATE
    'http://maps.googleapis.com/maps/api/directions/xml?origin='
    <fs_dest>-place_f '|' <fs_dest>-lat_f ',' <fs_dest>-lng_f
    '&destination=' <fs_dest>-place_t '|' <fs_dest>-lat_t ',' <fs_dest>-lng_t
    '&alternatives=' 'true'
    INTO lv_http_url .

where:
lv_address               = From/To address
<fs_dest>-place_f = From address
<fs_dest>-lat_f      = From address latitude
<fs_dest>-lng_f     = From address longitude
<fs_dest>-place_t = To address
<fs_dest>-lat_t      = To address latitude
<fs_dest>-lng_t      = To address longitude

Use this cl_http_client class and the create_by_url function to obtain the detailed information after you have the relevant API URL.

* Get client from url
  CALL METHOD cl_http_client=>create_by_url
    EXPORTING
      url                = lv_http_url
    IMPORTING
      client             = p_http_client
    EXCEPTIONS
      argument_not_found = 1
      plugin_not_active  = 2
      internal_error     = 3
      OTHERS             = 4.

Please review the detailed code to see how it functions. We merely intended to illustrate the options. There may be more efficient ways to read these APIs and XML data. You can investigate further to determine the best course of action.

Please feel free to contact us or ask a question in the comment section if you need help understanding the code or an idea. Without a doubt, we would react.

Would you kindly click the share buttons if you enjoyed this post?

I sincerely appreciate your time!


you may be interested in this blog here:-

How Many Employees Does Salesforce Have in 2024?

Role of SAP Consultants in Modern Business Transformations

Advanced Code Snippet Techniques : Mastering the Craft

  • Related Posts

    Common SAP ABAP Interview Questions and Answers

    Preparing for your first SAP ABAP interview can feel confusing. Many beginners know the syntax, but still struggle to answer practical questions asked by interviewers. In 2026, companies expect more…

    How to Debug SAP ABAP Programs Like a Pro

    Debugging is one of the most important skills for any SAP ABAP developer. Writing code is only half of the job. In real projects, most of your time is spent…

    Leave a Reply

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

    You Missed

    Common SAP ABAP Interview Questions and Answers

    • By Varad
    • March 5, 2026
    • 299 views
    Common SAP ABAP Interview Questions and Answers

    How to Debug SAP ABAP Programs Like a Pro

    • By Varad
    • March 4, 2026
    • 143 views
    How to Debug SAP ABAP Programs Like a Pro

    Can ChatGPT Help in Learning SAP ABAP

    • By Varad
    • March 3, 2026
    • 32 views
    Can ChatGPT Help in Learning SAP ABAP

    Can Automation Replace SAP ABAP Developers?

    • By Varad
    • February 28, 2026
    • 78 views
    Can Automation Replace SAP ABAP Developers?

    SAP Automation vs Manual Testing: Career Comparison

    • By Varad
    • February 27, 2026
    • 87 views
    SAP Automation vs Manual Testing: Career Comparison

    Tools Used For Sap Automation Testing in 2026

    • By Varad
    • February 26, 2026
    • 122 views
    Tools Used For Sap Automation Testing in 2026