on 05-28-2007 10:47 AM
Hi,
I have a mapping where 4 source values makes the key for 1 target value.
In the target string (result after value mapping) i want to get the last value in the string "TargetValue1.
<i>SourceValue1;SourceValue2;SourceValue3;SourceValue4;TargetValue1</i>
Can this be done without UDF? If not how should the UDF look like?
Best Regards
/Claes
/
Message was edited by:
Claes Widestadh
Hi Claes,
Please elaborate your issues.I think you talking about concate 4 source value to single target?
Cheers!
Samarjit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes I have concatenated 4 source values into one string to use them as key in a value mapping to get the target value. The result from the value mapping is a string with the 4 source value + the target value. What I want to do now after the value mapping is to spit this string to get only the target value.
The string looks like this
Source sting
example 1) CC;-;ADJ;fre;
example 2) CR;+;ADJH;TD;
Target string:
example 1) CC;-;ADJ;fre;<b>985</b>
example 2) CR;+;ADJH;TD;<b>553</b>
It is the value 985 or 553 that i want to map into the target field. The position for the target value (985, 553) is not a fixed position because of that the length of the source values can vary (see example obove). That means that I cant use the substring right?
/Claes
Message was edited by:
Claes Widestadh
null
null
Hi Shabarish Vijayakumar,
I'm trying this UDF that you wrote but I doesn't get it to work.
I'm quite new to UDF´s. In this example what should I use as arguments, imports? Should I use value as cache?
if a use value as cache and a as argument i get this error.
MappingTemplate_.java:356: a is already defined in Split$(java.lang.String,com.sap.aii.mappingtool.tf3.rt.Container) String a[] = splits.split(";"); ^ 1 error
Thanks for all the help.
Best Regards
Claes
hi Claes
You can use global container for this purpose.
You need to write two UDFs
In first UDF , give the concatenated value as input and put it in global container ( in one variable)
In the another UDF (where you will actually perform string operations to get last value) , use this value from global container.and perfor string operations
Regards
Sheetal
Please reward points for helpful anwers
Hi Sheetal,
Can you please show me how you mean?
What should i write in the first UDF. As you have noticed I´m quite new to UDF´s.
In the second UDF I use the code that Samarjit proposed but I don't know what I should write instead of XXXXXX to get the concatenated values "into" the UDF.
String strC =
XXXXXX
;int intC = strC.lastIndexOf(";");
strC = strC.substring(intC+1);
return(strC);
Thank you for all the help.
Best Regards
Claes
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
that sud help u define a UDF.
From your last post i am tryin to recreate the UDF,
Create a simple UDF (Simple Functions (Cache = Value) - ref above link)
and put the code as below;
String strC = a;
int intC = strC.lastIndexOf(";");
strC = strC.substring(intC+1);
return(strC);
hi Claes
In the first UDF , take input as concatenated value and place this value in global container using
setParameter (String parName, inputValue);
In the second UDF , get this value from global container in one variable
using
localVaribleName (strC in ur case) = getParameter (String parName);
use this variable for furthur manipulation and map the output of this UDF (tsrC) to your final target field
regards
Sheetal
plz reward helpful answers
hi
you can use the standard function like substring , index of where in you will get the last value from the concatenated string.
if u give the exact values i will tell you the mapping
regards
Sheetal
plz reward points for helpful answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Claes,
U can use Fix Mapping for this
Key Value
SourceValue1 TargetValue1
SourceValue2 TargetValue1
SourceValue3 TargetValue1
SourceValue4 TargetValue1
In the above case whatever comes ur sourcevalue of above four Target value will only 1....As Fix Mapping allows u to have Multiple keys for the same value
Regards,
Ashwin M
Reward if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.