cancel
Showing results for 
Search instead for 
Did you mean: 

Code for dynamic configuration

Former Member
0 Kudos

Any code available for dynamaic configuration?

Accepted Solutions (1)

Accepted Solutions (1)

GabrielSagaya
Active Contributor
0 Kudos

To access the classes DynamicConfiguration and DynamicConfigurationKey by using the mapping runtime constant DYNAMIC_CONFIGURATION, use the method getTransformationParameters() of the container object.

The following program code for a user-defined function changes the value of the file adapter parameter FileName

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(

u201Chttp://sap.com/xi/XI/System/Fileu201D,

u201CFileNameu201D);

String valueOld = conf.get(key);

if (valueOld != null) {

String valueNew = valueOld.replaceAll(u201Cinputu201D,u201Doutputu201D);

conf.put(key, valueNew);

}

http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Check this..

// access dynamic configuration

DynamicConfiguration conf = (DynamicConfiguration) param.get(

StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

// read value

String Filename = conf.get(KEY_FILENAME);

https://media.sdn.sap.com/javadocs/NW04/SPS15/pi/com/sap/aii/mapping/api/DynamicConfiguration.html

Regards,

Soumya

Former Member
0 Kudos

Chk this code

Imports com.sap.aii.mapping.api.DynamicConfigurationKey;com.sap.aii.mapping.api.DynamicConfiguration;

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String SourceFileName = conf.get(key);

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );

dateformat.format( new java.util.Date() );

String newfilename=SourceFileName+dateformat;

// change to new file name

conf.put(key, newfilename);

return "";