Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

UDF (Queue), help me with this error.

Hi All,

I am trying to convert an array of values to integers an i want to add a constant value to each value in the queue .Below is my code please help me.

Input :- 10 values from the source

output : each value + some constant.

int input[] =  new int[10];

  int k=10;

  int j[]= new int[10];

  for(int i=0; i<10; i++)

  {

  input[i] = Integer.parseInt(var1[i]);

result.addValue(j[i]=input[i]+k);

result.addContextChange();

  }

Error :

Source text of object Message Mapping: MM_Test | http://cmstran.com has syntax errors:  
Former Member
Former Member replied

Hi Vijay,

Please make sure that the 'Execution Type' of your UDF is set to 'All Values of Queue'.

Please make sure that you didn't add any extra open/closed braces.

I executed your UDF and it is perfectly working fine.

I suggest you to change the UDF like given below so that you can improve its functionality so that it will work for any no. of values in the queue (not just 10).

int var1Length = var1.length;

int input[] =  new int[var1Length];

  int k=10;

  int j[]= new int[var1Length];

for(int i=0; i<var1Length; i++)

{

input[i] = Integer.parseInt(var1[i]);

result.addValue(j[i]=input[i]+k);

result.addContextChange();

}

Regards,

Samanth Kunapareddi

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question