Skip to Content

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

Regarding the udf


Hi experts,

               i had a requirement where i need to send the customer no to the target .the input can be either numeric or alpha numeric or it can be null some times. if it is numeric value i need get input no preceeded by '0'  i have tried the following code and it worked for both the alphanumeric input values but it doesnot work for the null values.could you please suggest me . suggested person will be appriciated.

Execution type: single values i have taken


int count = 0;

for (int i = 0; i <= var1.length(); i++)

{

if(!Character.isDigit (var1.charAt(i)))

{

count = count +1;

break;

}

}

if (count>=0)

{

return var1;

}

else

{

String format = String.format("%010d",Integer.parseInt(var1));

return format;

}

Thanks

Giridhar

Former Member
replied

Hi Girdhar,

Have you tried this?:

int count = 0;

if  (var1.length() == 0) {

return null;

}

for (int i = 0; i <= var1.length(); i++)

{

if(!Character.isDigit (var1.charAt(i)))

{

count = count +1;

break;

}

}

if (count>=0)

{

return var1;

}

else

{

String format = String.format("%010d",Integer.parseInt(var1));

return format;

}

You can control the null values at the beginning.

Regards.

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