Skip to Content

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

Problem with Variable declaration in UDF

Hi,

I have UDF to generate queue,and it was implemented by someone. Now i need to use the same UDF in new mapping for generating new queue.

Here the Problem is UDF has some varaible "m" it wasn't declared in the UDF and working fine in previous mapping.

Now i'm getting some syntax errors when i'm using the same in new mapping like variable not delcared.

Now i need to knowIs this variable was globally declared? if so how can i declare the same in my new mapping

here i'm posting the code...

public void GenerateQ(String[] tdid,String[] zi20,ResultList result,Container container){

int i = tdid.length;

int j = zi20.length;

int k = i +j;

String s;

MappingTrace mt = container.getTrace();

for (int x =0; x<j; x++)

{

if(x ==0){

m = m + 1;

s = String.valueOf(m);

result.addValue(s);

*result.addValue(s); *

}

else if ( zi20[x].equals(ResultList.CC))

{

// mt.addInfo("Inside elseif");

m = m + 1;

s = String.valueOf(m);

// mt.addInfo(s);

result.addValue(s);

}

else

{

// mt.addInfo("Inside else");

s = String.valueOf(m);

// mt.addInfo(s);

result.addValue(s);

}

}

here m is variable for counter if i declared int m=0; UDF is not working properly it shows the counter always 1

can anybody suggest on this

regards,

Sandeep

Former Member
replied

Hi,

Open message mapping editor and upper right tool tip with "Edit java section" there u cn declare the global variable. at initialization section. declare m = 0;

Thanks!

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