Purpose You want to support the user when entering addresses by making suggestions during the input. We show this by means of the address entry in transaction BP - Business Partner: ![]() |
Solution Autocomplete is a feature of the Places library in the Google Maps JavaScript API. You can use autocomplete to give your applications the type-ahead-search behavior of the Google Maps search field. The autocomplete service can match on full words and substrings, resolving place names, addresses, and plus codes. Applications can therefore send queries as the user types, to provide on-the-fly place predictions. Requirements: As you need an API key for the Google Service, you may need to create an account in the Google Cloud Platform. At present, use is free of charge up to a relatively generous quota. Essentially, with the GuiXT controls, you embed an HTML page that includes some JavaScript and calls the Google service for address completion. After the user selects an address from the list, a GuiXT JavaScript object is used to insert the parts of the address into the corresponding fields on the SAP screen. |
Implementation We define the API key and the filename of the InputScript, that will be started when the user selects an address from the list of suggestions. Occurrences of the corresponding placeholders in the HTML template are automatically replaced with the corresponding values. In this example, the placeholders &[apikey] and &[inputscript] are replaced with the values that we assign to the GuiXT variables apikey and inputscript. GuiXT Script
GuiXT
(The Google API can no longer be used with the Internet Explorer Control - GuiXT command "control" - but only works with the WebView.) InputScript "AutoComplete.txt"
GuiXT
Autocomplete_template.html HTML Explanation of options:
Google Maps Platforrm - Places Autocomplete |
Download: All files for this project can be downloaded here: google_guixt_autocomplete.zip |
Components InputAssistant+Controls |