Skip to Content
avatar image
Former Member

Display geolocation via external api, in SAP Business One


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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    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

    Add comment
    10|10000 characters needed characters exceeded

  • 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

    Add comment
    10|10000 characters needed characters exceeded