05-28-2014 11:31 AM
Hi all,
My requirement is to delevop a report. The report will have an ALV table with supplier information. Along with that, the lattitude & longitude of the supplier's address needs to be displayed.
I tried using the method ENHANCE_ADDRESSES of class CL_ADDRESS_ENHANCER. But i am able to get the details at country level only.
But i Need the co-ordinates at street level. Any way of doing that ??
Thanks,
Karthik
05-28-2014 1:03 PM
05-28-2014 11:36 AM
Hi,
there is a module for this, have a look to the tables starting with GEO*
for examples : GEOCITY give for a city the longitude latitude.
You could also find a table that give for a postal code the longitude latitude.
There is a group in SCN speak about that, and how to link with google maps.
There is also a function that give you the distance between two points, but it's direct distance, not street distance
regards
Fred
05-28-2014 11:44 AM
Yeah,
I know there are lots of tables. But all of them are empty. Even if you download all the latitude & longitude Information, Every day a new street will be formed or the name would be changed.
So the static data cant be trusted. My guess is that we need to create a webservice to get the LAT & LONG. But Not sure how. ANy Idea?
NOTE: I need to display the data in report only. not in browser.
05-28-2014 12:52 PM
Hi karthikeyan ,
what information you were passing addresses in method ENHANCE_ADDRESSES ?
Its working fine for me
Regards
Yogendra Bhaskar
05-28-2014 12:58 PM
I am passing the Address number to the FM ADDR_GET. i am then moving the address to an internal table and passing to addresses in ENHANCE_ADDRESSES.
FYI, i am getting the co-ordinates. But only at the country level. But not the Street level. COuld you provide the code ??
05-28-2014 1:13 PM
Hi karthikeyan ,
Co-ordinates are at region level also.
I have also coded the same way.
For different region code in same country , you will get different co-ordinates.
and it's True , they are not at street level.
Try something else.............Best of luck
Regards
Yogendra Bhaskar
05-28-2014 12:26 PM
Karthikeyan,
Not exactly the kind of info you are looking for, but may be this can give you some lead.
TIMEZONE for a Country code will be maintained in the table GEOT005.
Country Code will be maintained in T005
I think it needs to be checked with the Functional Consultant whether required entries were maintained for all the Country Codes (SPRO).
K.Kiran.
05-28-2014 12:55 PM
This is called "geocoding" and you would need to use some third-party service provider (addresses database + their geolocation).
You can make it from scratch. I would go probably Google Geocoding API way... but there are more (Yahoo etc..).
Or give a try some existing projects. For example this looks interesting:
Home | ZGEOCODE Project | Assembla
05-28-2014 1:03 PM
05-28-2014 1:09 PM
I ve tried all. These things show how to integrate a google map to WDA / BSP. But my requirement is different . I need them in ALV table in my report
THanks,
Karthik
05-28-2014 1:29 PM
Read more carefully the google documentation for Geocoding Services
You have to send
{
address: string,
location: LatLng,
bounds: LatLngBounds,
region: string
}
address (required*)
latLng (required*)
bounds (optional)
region (optional)
componentRestrictions (optional)
* Note: You may pass either an address
or a latLng
to lookup, so pass only the address
You will get
{
types[]: string,
formatted_address: string,
address_components[]: {
short_name: string,
long_name: string,
postcode_localities[]: string,
types[]: string
},
partial_match: boolean,
geometry: {
location: LatLng,
location_type: GeocoderLocationType
viewport: LatLngBounds,
bounds: LatLngBounds
}
}
But you should better execute the call of the web services during master data maintenance, so only called once per customer, vendor or other partner. (And stay in free of charge area without )
Regards,
Raymond
05-28-2014 1:48 PM
My Requirement is for ABAP report only. NOt for BSP or WDA. I ve made it clear in the top. I am not sure how to do the above HTML coding in a SE38 Report.
THanks,
Karthik
05-28-2014 8:25 PM
Hi,
I believe he was suggesting to enhance the master data maintenance to get the coordinates with extended fields in the table. In that scenario your ALV report would be simple and it would be a matter of imtegrating reverse geocoding services into the data entry process. Since most services like that have usage limits this would probably be a better approach anyways.
Regards,
Ryan Crosby
05-28-2014 11:36 PM
Hello,
Raymond is right, you should have a closer look to the google API...
The API is really simple to use and clearly documented.
start by building the url for the request:
concatenate 'http://maps.google.com/maps/api/geocode/xml?address='
YOUR_ADDRESS
'&sensor=false' into l_http_url.
then create a new http client object:
call method cl_http_client=>create_by_url
exporting
url = l_http_url
importing
client = l_http_client
exceptions
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
others = 4.
if sy-subrc is not initial.
"raise invalid_request.
endif.
Set the request method
l_http_client->request->set_header_field(
name = '~request_method'
value = 'GET' ).
Set header
l_http_client->request->set_header_field(
name = 'Content-Type'
value = 'text/xml; charset=utf-8' ).
Send the request
l_http_client->send( ).
Reterive the result
call method l_http_client->receive
exceptions
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
l_content = l_http_client->response->get_cdata( ).
condense l_content.
split l_content at cl_abap_char_utilities=>newline into table lt_response .
And finally, lookup for your localization data in table lt_response.
or you could also parse the XML generated in variable l_content...
There many things possible with that API, just give it a try
The free usage has some limitations also, like a max of 2500 geolocalization per day if I well remembered.
So I guess the remark from Raymond:
But you should better execute the call of the web services during master data maintenance, so only called once per customer, vendor or other partner. (And stay in free of charge area without )
is really pertinent!
Have fun,
Manu.
06-11-2014 11:14 AM
HI, That worked. But people feel that i need to use HTTPS insted of HTTP. If i use HTTPS in the existing code, i get a http_communication_failure. Is there any way ato use https ?
ALso learnt from some of the blogs that, if we need to make HTTPS calls, we have to install the digital certificate from google using STRUST tcode. Else we woluld always get http_communication_failure.
An idea would be helpful
Thanks,
Karthik