Skip to Content

Display geolocation via external api, in SAP Business One

Nov 07, 2016 at 08:30 PM


avatar image


I'm currently developing some forms with Visual Studio, and the SAP Business One SDK, and one of them is required to display the geolocation in, preferably, a map, in SAP Business One, through the data it receives from an external API, which I use a POST method with the parameters. I've searched everywhere for some kind of help on how to do this, any suggestions would be appreciated.

Paulo Sérgio

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
DIEGO LOTHER Nov 07, 2016 at 11:47 PM

Hi Paulo,

If I understood what you need, you can do something like this:

            //Do your request for your external API
            using (var client = new WebClient())
                NameValueCollection values = new NameValueCollection();
                values["param1"] = "param 1";
                values["param2"] = "param 2";
                values["param3"] = "param 3";

                //The variable "values" is the post param that the api will process
                var response = client.UploadValues("your link for your external api", values);
                string responseString = Encoding.Default.GetString(response);

                //Now use the API for your preference to work with the json. I suggest Newtonsoft.Json

            //Do the following query on the sap company database
            //SELECT QueryUrl FROM OADM T0 INNER JOIN OMPS T1 ON T0.MapService = T1.AbsEntry
            //This query will return the configured map service url, like below
            string url = @"[Street][City][County][State][Country]";
            //With your url on hand, replace the variables like [Street], [City] .... with the values that you received from your external API

            //And now call the browser for the user. The command below will open the default browser, outside of SAP B1 like
            //if you go to the BusinessPartner form, go to address tab and click on "Show Location in Web Browser" link

Kind Regards,

Diego Lother

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thank you very much for the help, I will be fully testing my solution, but this is exactly what I needed.

Pedro Magueija Nov 08, 2016 at 09:04 AM

Hi Paulo,

You can also use the WebBrowser control to display the map inside B1 (note, however, that the WebBrowser is not available in the Web Access Mode of B1).

SAPbouiCOM.Item oItem = oFirstForm.Items.Add("WebBrowser", SAPbouiCOM.BoFormItemTypes.it_WEB_BROWSER); 
oItem.Left = 20; 
oItem.Top = 20; 
oItem.Width = 200; 
oItem.Height = 200; 
SAPbouiCOM.WebBrowser oWebBrowser = (SAPbouiCOM.WebBrowser)oItem.Specific; 
//Open the WebPage 
oWebBrowser.Url = ""; 

You can find this sample and more information in the SDK Help Center.

Pedro Magueija

LinkedIn | Twitter | Blog

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Sorry I wasn't able to also "Accept" your answer, but both yours and Diego's answer really helped me out. Thanks again.

Paulo Sergio da Silva Junior

No worries ;)

I'm glad it was helpful.

Pedro Magueija

LinkedIn | Twitter | Blog