cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem:filling field with 0 (zeros) in material number

Former Member
0 Kudos

I want to create a mapping like the ABAP function:

CONVERSION_EXIT_MATN1_INPUT

for example:

1 => 000000000000000001(add zeros if input value is

numeric)

Z => Z(no change if input is not numeric)

The standard function "formatnum" works well from 1 => 000000000000000001.But it causes a java exception from Z => Z.

How to solve it?

Must i develop a UDF?

thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Deleted content.

Former Member
0 Kudos

I used "Format Number" function in graphical mapping.

But it causes a java exception with the input value 'Z'.

former_member189558
Contributor
0 Kudos

You use a UDF...

Since for Z it should not format number it is throwing the error.

Inside UDF handle numbers separately and Alphabets separately.

Cheers,

Himadri

Shabarish_Nair
Active Contributor
0 Kudos

if i understood your requirement, you need to do padding(left) for your input. In that case use this UDF to help you out;

int len = 10 ; // the maximum length of the field in your target.

StringBuffer sBuf= new StringBuffer(a);

while (sBuf.length() < len) {

sBuf.insert(0,'0');

}

return(sBuf.toString());

Message was edited by:

Shabarish Vijayakumar