I have created a Java Web Dynpro in the portal intranet. The localhost of the local machine is needed, but I'm only able to get the servername, serverlocalhost and the local machine ip-address.
When I'm running following code on a local java program, I'm getting:
- Workstation: BEWSP
- IP: 10.10.19.112
When I'm running following code on a SAP Portal program, I'm getting:
- Workstation: SAPDEP
- IP: 10.10.19.112
I need to get BEWSP in my SAP Portal application, any idea to do this?
InetAddress ip = InetAddress.getLocalHost();
String workstation = "";
String currentip = "";
//Workstation
System.out.println("Workstation : " + ip.getHostName());
workstation = "" + ip.getHostName();
//Ip address
System.out.println("Current IP address : " + ip.getHostAddress());
currentip = "" + ip.getHostAddress();
KR
Just to add the implementation of way chosen by OP: