on 01-13-2012 5:39 AM
Hi Expert,
I have requirement like, One Source System and Two Target System. In that source system I have input like First Name last Name and age department. In First target side I need a output like Name(FirstName+LastName), Age , Department but in my Secound Target System I need a outPut Only First Name , Age and Department. How Can I write a UDF for this. Anyone can help me out in this?
Thanks
Mary Durai
Hi, I suggest to create two mappings, one for each target system. In the first mapping you can use the concat function to concatenate names.
Then you have to create two interface determinations in order to execute the appropriate mapping for each target system.
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mary,
You should be able to just use the mapping contexts and have one message mapping because you can differentiate context by using the constant for receiver. You then can feed that in as a parameter to a UDF or use regular graphical mapping logic to determine the concatenation output for the field.
Regards,
Ryan Crosby
HI Mary,
Let me give a simple solution!!!
Solution is simple If it is ok for you to hardcode the target system names in the UDF.
Also consider the multiple instances of ur Target System names (Dev, QA, Prod).
If you are using PI 7.1 and above then pass all parameters which you require for the UDF plus an EXTRA node called
"RECEIVER" to the UDF. This option is there in constants TAB in the mapping.
Inside, UDF write condition something like ,
if (RECEIVER = TargetSysADev || RECEIVER = TargetSysAQA || RECEIVER = TargetSysAProd )
{return Firstname+Lastname}
else
(if RECEIVER = TargetSysB)
{return Firstname}
Here, there is also an assumption that you are handling the other stuff to route the message to system A and B respectively.
Please let me know if this is complex!!!!!!!!!
Thanks,
VK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This UDF will give you the receiver component of your message
GlobalContainer globalContainer;
AbstractTrace trace;
String headerField;
java.util.Map map;
// Get trace using the container object
// (which is passed by parameter u2018containeru2019
// to this user-defined function)
trace = container.getTrace();
// To get a global container, use method getGlobalContainer()
// of the container object
globalContainer = container.getGlobalContainer();
// There are two ways of getting the runtime constant map now:
// a) by calling container.getTransformationParameters() or
// b) by calling globalContainer.getParameters().
map = globalContainer.getParameters();
// get the value for a header field
headerField = (String) map.get(
StreamTransformationConstants.RECEIVER_SERVICE);
// output value to trace and return it
trace.addInfo("Receiver Component:" + headerField);
return headerField;
you can find more info about the constants here:
[http://help.sap.com/saphelp_nwpi71/helpdata/en/43/c3e1fa6c31599ee10000000a1553f6/frameset.htm]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.