cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the WD port number of the actual system?

uta_bchner
Explorer
0 Kudos

Hello everybody,

In my application I'm calling a Sap Gui transaction through an ITS WebGUI link that is generated dynamically by an action method. Works find so far.

However, as the code has to run on various systems (development, test, production) I also have to generate the system and port name dynamically. System name is no problem, but how can I get the WD port of the actual system? Is there any method or variable for that? Couldn' find anything so far...

Thanks in advance for any help!

Accepted Solutions (1)

Accepted Solutions (1)

saravanan_narayanan
Active Contributor
0 Kudos

Hello,

As Thomas mentioned, you have to use the utility class to construct the URL for any application.

you have two options here

Option 1 -> Prefix your generated WebGUI link with '/' and pass it to the method CL_URL->HOST in the URL parameter. this method will prefix the corresponding http:<host>:port to the passed in URL.

Option 2 -> you can directly use the method CL_URL->ITS to generate your entire web GUI link.

BR, Saravanan

Answers (2)

Answers (2)

uta_bchner
Explorer
0 Kudos

Thanks a lot, everything is working fine now!

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You shouldn't build the server name and port manually for just the reasons you've ran into. Instead use one of the SAP supplied helpers like the class CL_URL. It has methods for building the URLs for ITS, WDA, BSP, etc. You could also consider using relative URLs so the browser can just assume the same host/port as the current page if you are navigating directly from WDA.