Skip to content

Instantly share code, notes, and snippets.

@viksingh
viksingh / setSeeburgerVariable.java
Created February 9, 2018 01:10 — forked from SriniBlog/setSeeburgerVariable.java
This UDF can be used to write the Seerburger Variable
public String setSeeburgerVariable(String variableName, String variableValue, Container container) throws StreamTransformationException{
try
{
VariableBean be=VariableFactory.getVariableInstance("");
be.setStringVariable(variableName, variableValue);
}catch (Exception e){
throw new RuntimeException(e);
}
return "";
}
@viksingh
viksingh / getSeeburgerVariable.java
Created February 9, 2018 01:10 — forked from SriniBlog/getSeeburgerVariable.java
This UDF can be used to read the Seerburger Variable
public String getSeeburgerVariable(String variableName, Container container) throws StreamTransformationException{
AbstractTrace trace;
trace = container.getTrace();
String variableValue = "";
try
{
VariableBean be=VariableFactory.getVariableInstance("");
variableValue = be.getStringVariable(variableName);
if ( variableValue!= null)
@viksingh
viksingh / getStreamTransformationConstant.java
Created February 9, 2018 01:10 — forked from SriniBlog/getStreamTransformationConstant.java
This UDF is used to get the Runtime Parameters from the StreamTransformation Constants
public String getStreamTransformationConstant(Container container) throws StreamTransformationException{
GlobalContainer globalContainer;
MappingTrace trace;
String headerField;
java.util.Map map;
trace = container.getTrace();
globalContainer = container.getGlobalContainer();
map = globalContainer.getTransformationParameters();
headerField = (String) map.get( StreamTransformationConstants.INTERFACE_NAMESPACE );
@viksingh
viksingh / splitValue.java
Created February 9, 2018 01:10 — forked from SriniBlog/splitValue.java
This Advanced UDF use to split the field value based on the splitter character
public void splitValue(String FieldValue, String SplitterChar, ResultList result, Container container) throws StreamTransformationException{
try{
//Split the string value based on the splitterchar
String [ ] strArray = FieldValue.split(SplitterChar);
int istrArray = strArray.length;
for (int i=0; i < istrArray; i++){
result.addValue(strArray[i]);
}
}catch(Exception ee){
}
@viksingh
viksingh / getInstanceUDF.java
Created February 9, 2018 01:11 — forked from SriniBlog/getInstanceUDF.java
This is a psedu code to show how to get the instance of the trace, dynamic configuration etc. inside the UDF
public String getInstanceUDF(Container container) throws StreamTransformationException{
GlobalContainer globalContainer;
MappingTrace trace;
String headerField;
java.util.Map map;
trace = container.getTrace();
globalContainer = container.getGlobalContainer();
map = globalContainer.getTransformationParameters();
headerField = (String) map.get( StreamTransformationConstants.INTERFACE_NAMESPACE );
@viksingh
viksingh / setGlobalParameter.java
Created February 9, 2018 01:11 — forked from SriniBlog/setGlobalParameter.java
This method can be used in UDF to write the parameter to GlobalContainer instance
public String setGlobalParameter(String Parameter, String ParameterValue, Container container) throws StreamTransformationException{
try{
GlobalContainer gc = container.getGlobalContainer();
gc.setParameter(Parameter, ParameterValue);
}catch(Exception ee){
}
return ParameterValue;
}
@viksingh
viksingh / getGlobalParameter.java
Created February 9, 2018 01:12 — forked from SriniBlog/getGlobalParameter.java
This method can be used in UDF to read the parameters from GlobalContainer instance
public String getGlobalParameter(String Parameter, Container container) throws StreamTransformationException{
String ParameterValue = "";
try{
GlobalContainer gc = container.getGlobalContainer();
ParameterValue = (String) gc.getParameter(parameter);
}catch(Exception ee){
ParameterValue = "";
}
return ParameterValue;
}
@viksingh
viksingh / setDynamicFileName.java
Created February 9, 2018 01:12 — forked from SriniBlog/setDynamicFileName.java
This method is used in SAP PI Mapping UDF to write the FileName Dynamic Configuration
public boolean setDynamicFileName(String FieldValue, Container container) throws StreamTransformationException{
boolean success = false;
try{
//Get the DynamicConfiguration instance
DynamicConfiguration config = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//Define key to write in the Dynamic Configuration
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
//Write the FileName parameter from the Dynamic Configuration based on the key
@viksingh
viksingh / getDynamicFileName.java
Created February 9, 2018 01:12 — forked from SriniBlog/getDynamicFileName.java
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
@viksingh
viksingh / setDynamicConfiguration.java
Created February 9, 2018 01:14 — forked from SriniBlog/setDynamicConfiguration.java
This method is used in SAP PI Mapping UDF to write the Dynamic Configuration
public boolean setDynamicConfiguration(String Namespace, String FieldName, String FieldValue, Container container) throws StreamTransformationException{
boolean success = false;
try{
//Get the DynamicConfiguration instance
DynamicConfiguration config = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//Define key to write in the Dynamic Configuration
DynamicConfigurationKey key1 = DynamicConfigurationKey.create(Namespace, FieldName);
//Write the parameter from the Dynamic Configuration based on the key