Skip to content

Instantly share code, notes, and snippets.

@SriniBlog
Last active February 9, 2018 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SriniBlog/2ba612e10f67d56140a7 to your computer and use it in GitHub Desktop.
Save SriniBlog/2ba612e10f67d56140a7 to your computer and use it in GitHub Desktop.
This method is used in SAP PI Mapping UDF to read the FileName from the Dynamic Configuration
public String getDynamicFileName(Container container) throws StreamTransformationException{
String FileValue = "";
try{
//Get the DynamicConfiguration instance
DynamicConfiguration config = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//Define key to read from the Dynamic Configuration
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
//Read the FileName parameter from the Dynamic Configuration based on the key
FileValue = config.get(key1);
}catch(Exception ee){
FileValue = "";
}
return FileValue;
}
@ronin98
Copy link

ronin98 commented Jan 4, 2017

Correction: FileValue = conf.get(key1);

When you create the UDF in the mapping, you don't have to define an argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment