on 04-23-2008 8:21 AM
Dear All
Is it possible to get the Server name / Hostname of server dynamically by using the java code / java API in User Defined function . Any help is appreciated .
regards
Nilesh .
Hi,
Use this Blog and Implement the Logic inside this.
Check the Check box Source FTP Host in ASMA of sender File adapter
And Change this line in the Code
//for getting Host Name
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Source FTP Host ");
Regards
Seshagiri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nilesh,
you can acess System-properties like this way:
String user_login_id = System.getProperty("user.name");
return user_login_id.substring(0,3);
in UDF.
FAQ: How do I access/read system properties and environment variables?
http://www.devdaily.com/blog/post/java/java-faq-access-read-system-properties-environment/
regards Mario
Edited by: Mario Müller on Apr 23, 2008 3:54 AM
You also can get system properties from the System JAVA object, like SAPSYSTEMNAME for the SID or SAPGLOBALHOST (or similar) for hostname, like :
String PropertyValue = (String) System.getProperty("SAPGLOBALHOST ");
They have the same name as instance profiles vars, they are set by J2EE at startup, I think ...
Chris
Edited by: Christophe PFERTZEL on Apr 23, 2008 11:07 AM
Hi yes,
it is possible. You have to fill the dynamic attributs in your communication channel.
Than access the attrubute via UDF:
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
Sample:
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
String valueOld = conf.get(key);
if (valueOld != null) {
String valueNew = valueOld.replaceAll(input,output);
conf.put(key, valueNew);
}
See also:
Adapter-Specific Message Attributes
http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
Regards Mario
Edited by: Mario Müller on Apr 23, 2008 3:28 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.