This package contains the class ZCL_GEOCODE_NOMINATIM which implements the interface IF_GEOCODING_TOOL. Classes of that interface can be set in the customizing for geocoding addresses. To customize go to SAP NetWeaver -> General Settings -> Set Geocoding.
The geocoder class uses Nominatim geocoding service based on OpenStreetMap Data. Please read their wiki page for further information.
IMPORTANT: Nominatim is a free service and should be used with care. If you plan to do high volume geocoding consider implementing your own OpenStreetMap Server.
How does it work?
When the class is activated in the customizing every address maintained i.e. via transaction BP is passed to the geocoding class. From the address data we build an URL that calls the Nominatim web service and a XML document is returned. This document is parsed and put in the format of SAP's geocoding interface. SAP saves the geocoded information in the table GEOLOC. The link to the business partner address is saved in the GEOOBJR table.
Watch it live and in action: SAP TechEd 2010 Demo Jam Submission Video.
Setup
Clone the package from here and install it using abapGit.
Make shure that your ABAP application server can connect to https://nominatim.openstreetmap.org/. You can create a HTTP destination in SM59 to test this. When you're behind a corporate firewall you have to configure a HTTP proxy. The global HTTP proxy setting can be done in transaction SICF.
In the Customizing at SAP NetWeaver -> General Settings -> Set Geocoding -> Register Geocoding Program in the System we add this line:
Source: ZNOM
Class: ZCL_GEOCODE_NOMINATIM
Text: Geocoding with OpenStreetMap Nominatim
Then in the next customizing step "Assign Geocoding Program to Countries" we add this line:
Country: DE
Sequence: 4.000
Source: ZNOM
Exclusive: X
The last step is adding these lines in the customizing for "Assign Relevant Address Fields for Geocoding":
Source | Field |
---|---|
ZNOM | CITY1 |
ZNOM | CITY2 |
ZNOM | COUNTRY |
ZNOM | HOUSE_NUM1 |
ZNOM | HOUSE_NUM2 |
ZNOM | POST_CODE1 |
ZNOM | REGION |
ZNOM | STREET |
Usage in the SAP NetWeaver ABAP Developer Edition
Create Business Partners
Start Transaction BP and create some Business Partners with an existing Address. It could happen that you need to customize the number ranges for the Business partners first.
ABAP Demo Program ZGEOCODE_NOMINATIM_READ_BP
With the program ZGEOCODE_NOMINATIM_READ_BP you can search for Business Partners and display their longitude and latitude. Also you can click on the Business Partner Number and start a Dynpro with an HTML Control displaying the address in OpenStreetMap using the BSP Application ZGEOCODE_OSM. You should have configuring the system to issue SAP Logon Tickets as described here. Make sure that also the Fully Qualified Domain Names (FQDN) is set as described here.
Changelog
2010-06-21: Added functionality to search business partners nearby
2010-07-04: Added BSP application ZGEOCODE_MOBILE to support BlackBerry
2014-01-14: Updated links to new ZGEOCODE Project home at Assembla
2022-02-28: Updated links to new ZGEOCODE Project home at GitHub