I am not an expert in this area, however one discussion has similar info. You may have to search more in the forum.
How to change & manage different ports in a mixed web environment (BSP/WAD)
run your template in the browser and do a "view source" to see the html code behind and you should see a js variable called
sapbi_page.m_masterSystemName which will hold the system id (logical system name)