on 12-21-2005 1:48 PM
Hello,
Does anybody know a way to get the sysid (or the current environment) at runtime using XSLT mapping.
Some simple java code is also Okay
Cheers
Emile
Message was edited by: Emile Hermans
1) Write some Java code to get the hostname
package com.company.xi;
public class MappingFunctions {
public String getServerHostname()
throws UnknownHostException {
InetAddress myAddress = InetAddress.getLocalHost();
return myAddress.getHostName();
}
}
2) Package it in a JAR and load it into the IR as an imported archive.
3) Call it from your XSLT
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mapping="java:com.company.xi.MappingFunctions">
<HostName><xsl:value-of select="mapping:getHostName()"/></HostName>
Thanks,
Jesse
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Alessandro,
Like what Jessie told you need to make a java code called in between. In the java code which is imported as an archive with the XSLT mapping you can add the following code to get the system id.
// Get the system properties
String sysNr = (String) System.getProperty("SAPSYSTEM");
String sysName = (String) System.getProperty("SAPSYSTEMNAME");
Cheers
JK
I like the above solution to get the SID using the System.properties calls.
If you need to get any other information for the environment like JCO connection parameters, etc you can do the following:
1) Maintain an XML file which maps hostname (or SID) to the values you want to lookup. I'd recommend maintaining all environments in this file (DEV, QA, PROD).
2) Load this file as an imported archive into the IR.
3) In your Java code:
- Get the hostname (or SID)
- Lookup the values from the XML file based on the hostname or SID
Thanks,
Jesse
Emile,
I have similar question: in what environment is a mapping executed: development, QA or production. There doesn't seem to be a standard way to obtain this.
Solution is (probably) to store it somewhere, e.g. in properties file on disk and read it from there with some Java code.
Good question. Kind regards, Guy Crets
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
USE MSS_GET_SY_SYSID FM and call it using mapping lookups or anything and that can be used for getting the system runtime id.
abap WITH XSLT CAN BE USED IF U WANT JSUT XI SYSTEM ID.
I HOPE THIS HELPS..;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
do u want the system id of the XI or sender or reciver?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Emile,
that could seem trivial but, believe, it is not...
I had tried this challenge some months ago but gave up.
What I can tell you is: (1) it's very likely to find Java code working rather than XSL and (2) I think you need to use some <i>forbidden</i> classes which are not documented...
Do you want me to go on checking that?
Let me know
ALex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.