on 05-18-2010 9:04 AM
HI ,
I have lots of countryCurrency from R3 side let say 10. I want to pass only 6 from xi to target .
for this I have Wriiten the UDF.
taking input as a queue:
UDF is below
public void filterUDF(String[] curr,ResultList result,Container container){
//write your code here
for(int i=1;i<=curr.lenght();i++)
if(curr<i>.equals("USD"))
{
reuslt.addValue(curr<i>);
}
else if(curr<i>.equals("IND"))
{
reuslt.addValue(curr<i>);
}
else if(curr<i>.equals("DE"))
{
reuslt.addValue(curr<i>);
}
else
{
reuslt.addValue(ResultList.SUPPRESS);
}
}
}
when I am using this UDF I am getting the below error
Activation of the change list canceled Check result for Message Mapping Exchange_Rate_CEZH_MM | .com:ExchangeRate_CRM: Starting compilation Source code has syntax error: E:/usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map71a412f0625311df85c8005056af4450/source/com/sap/xi/tf/_Exchange_Rate_CEZH_MM_.java:113: 'class' or 'interface' expected public static void main(String[] args) throws Exception{/!_$ClNRep_/_Exchange_Rate_CEZH_MM_ st = new /!_$ClNRep_/_Exchange_Rate_CEZH_MM_(); st.testExecute(); } ^ E:/usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map71a412f0625311df85c8005056af4450/source/com/sap/xi/tf/_Exchange_Rate_CEZH_MM_.java:114: 'class' or 'interface' expected } ^ E:/usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map71a412f0625311df85c8005056af4450/source/com/sap/xi/tf/_Exchange_Rate_CEZH_MM_.java:115: 'class' or 'interface' expected ^ 3 errors
IS there anything in synrax I am missing?
Regards
for(int i=1;i<=curr.lenght();i++)
if(curr.equals("USD"))
{
I think you need to add a { at the end of your for line.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Put this("i" is under square brackets):
for(int i=0;i<curr.length;i++)
{
if(curr[ i ].equals("USD"))
{
result.addValue(curr[ i ]);
}
else if(curr[ i ].equals("IND"))
{
result.addValue(curr[ i ] );
}
else
{
result.addValue(ResultList.SUPPRESS);
}
}
Thanks
Amit
Edited by: AmitSri on May 18, 2010 10:37 AM
Edited by: AmitSri on May 18, 2010 10:38 AM
Hi Amit,
My req is I am getting the 10 countries currency symbol in one field I want sent to target system
only 5 countries currency symbol(IND ,USD,DIN) like this for req i am using this UDF is there anything I am missing in this UDF
This fuction
//write your code here
for(int i=1;i<=curr.length;i++)
if(curr<i>.equals("USD"))
{
result.addValue(curr<i>);
}
else if(curr<i>.equals("IND"))
{
result.addValue(curr<i>);
}
else if(curr<i>.equals("DE"))
{
result.addValue(curr<i>);
}
else
{
result.addValue(ResultList.SUPPRESS);
}
giveing Mapping transformation error in MONI now
for this I took up queue when writing UDF
not value
Do I need to now do anything else in this UDF.
Regards
Edited by: Abahy Aggarwal on May 18, 2010 10:54 AM
Edited by: Abahy Aggarwal on May 18, 2010 10:55 AM
Hi Vijay,
I did the changes as you told but still below error is there in MONI
Runtime exception during processing target field mapping /ns0:Exchange_Rate_CEZH_Receiver_MT/item/TCURR. The message is: Exception:[java.lang.ArrayIndexOutOfBoundsException: 3] in class com.sap.xi.tf._Exchange_Rate_CEZH_MM_ method filterUDF$[] at
Hi,
//write your code here
for(int i=1;i<=curr.length;i++)
if(curr.equals("USD"))
{
result.addValue(curr<i>);
}
else if(curr.equals("IND"))
{
result.addValue(curr<i>);
}
else if(curr.equals("DE"))
{
result.addValue(curr<i>);
}
else
{
result.addValue(ResultList.SUPPRESS);
}
I have changed UDF like this withoutcurr<i>
and now it is not showing any error in MONI but when I send the message with USD and TTT currenices
both are not coming in output
PS.
According to UDF if USD,IND,DE is there they should be populated in payload. exclding these symbol nothing should populated
Please advice.
Regards
for(int i=0;i<curr.length;i++)
{
if(curr<i>.equals("USD"))
{
result.addValue(curr<i>);
}
else if(curr<i>.equals("IND"))
{
result.addValue(curr<i>);
}
else if(curr<i>.equals("DE"))
{
result.addValue(curr<i>);
}
else
{
result.addValue(ResultList.SUPPRESS);
}
}
use this code. this works for me so it sud for you too.
Also, in case you find issues, it would also be a good idea to get yourself used to java coding.
There are various tutorials available (google it)
Happy learning.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.