Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viksingh/79e5fe4d9ab7a9d05515b27d9624f330 to your computer and use it in GitHub Desktop.
Save viksingh/79e5fe4d9ab7a9d05515b27d9624f330 to your computer and use it in GitHub Desktop.
Learn to Read Dynamic Configuration in SAP PI Java Mapping
/*
* Author: Vanamala Srinivas
* Website: www.sriniblog.com
* Note: This is just a snippet and use it as a reference.
* Complete Blog: http://sriniblog.com/read-write-dynamic-configuration-in-sap-pi-using-java-mapping/
*/
public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException
{
trace = (AbstractTrace) getTrace(); //Capture trace object and write trace for debugging purpose.
DynConfig = arg0.getDynamicConfiguration(); //get the DynamicConfiguration Running Instance
if( DynConfig == null){
throw new StreamTransformationException("Unable to load the Dynamic Configuration Object!");
}
//Define the Key that we want to read
DynamicConfigurationKey Key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
//Read Dynamic Configuration
try{
String FileName = DynConfig.get(Key); //get method to read the key
if( FileName != null && !FileName.equals("") ){
trace.addInfo("Dynamic Configuration for Filename = " + FileName);
}else{
trace.addInfo("Unable to Read the Dynamic Configuration for File Parameter!");
}
}catch(Exception ee){
trace.addInfo("Unable to Read the Dynamic Configuration for File Parameter!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment