Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / getSeeburgerCounter.java
Created February 9, 2018 01:09 — forked from SriniBlog/getSeeburgerCounter.java
This is used to read the seeburger Counter value and auto increment the counter
//import com.seeburger.functions.permstore.*;
public String getSeeburgerCounter(String counterName, Container container) throws StreamTransformationException{
String counterValue = "";
try {
CounterBean be = CounterFactory.getCounterInstance();
counterValue = be.nextCounter( counterName );
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return counterValue;
@viksingh
viksingh / DBLookupUDF.java
Created February 9, 2018 01:09 — forked from SriniBlog/DBLookupUDF.java
DB Lookup from Standard SAP PI UDF to execute select query and get the records. This UDF can be used to call JDBC channel and execute the select query to fetch the records from database.
public String getDBLookupUDF(Container container) throws StreamTransformationException{
GlobalContainer globalContainer;
MappingTrace trace;
java.util.Map map;
trace = container.getTrace();
globalContainer = container.getGlobalContainer();
map = globalContainer.getTransformationParameters();
//Variables Used
@viksingh
viksingh / getRFCLookupUDF.java
Created February 9, 2018 01:09 — forked from SriniBlog/getRFCLookupUDF.java
RFC Lookup is simple UDF that can be used to execute RFC from UDF and fetch the output. This UDF uses RFC channel to make the calls to the SAP system.
public String getRFCLookupUDF(Container container) throws StreamTransformationException{
GlobalContainer globalContainer;
MappingTrace trace;
java.util.Map map;
trace = container.getTrace();
globalContainer = container.getGlobalContainer();
map = globalContainer.getTransformationParameters();
SystemAccessor rfcAccessor = null;
<?xml version="1.0" encoding="UTF-8"?>
<!--
Name: ProCon Invoice Mapping
Author: Chris Mills
Details: Mapping implemented as an XSL as single SAP Invoice message needs to be split to mutliple ProCon messages, 1 per PO
and financials calculated by unique PO. i.e. if invoice has 3 line items which relate to two PO's then need to split to
two output messages and calculate the tax and net amounts by PO, recursion much easier in XSL
NOTE: This will only send items from the invoice that relate to a contract, the business rules are meant to be no multi-contract
invoices and no mix of 1 item against a contract and another not but if it happens ProCon will only see parts of the invoice