Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

zero padding.

Former Member
0 Likes
4,050

i have account no 14500, but in program i want it 10 digit e.g. 0000014500.

how to convert account no with zero padding ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,674

Declare the variable type N.

ex: v_amt(10) type n.

pass the value to v_amt.

10 REPLIES 10
Read only

Former Member
0 Likes
2,674

data:accno(10) type n.

accno = '1405'.

unpack accno to accno.

Reward if helpful

Regards

Vodka.

Read only

Former Member
0 Likes
2,675

Declare the variable type N.

ex: v_amt(10) type n.

pass the value to v_amt.

Read only

gopi_narendra
Active Contributor
0 Likes
2,674

Use the FM : CONVERSION_EXIT_ALPHA_INPUT to convert it to 10 digit number.

Regards

Gopi

Read only

Former Member
0 Likes
2,674

Use the Function Module CONVERSION_EXIT_ALPHA_INPUT

Check the sample code:

data: NUMBER(8) VALUE 0, "Original number without zeros

NUMBER2(8). "numbers with zeros

*Incrementing value.

NUMBER = NUMBER + 1.

*Padding zeros

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = NUMBER

IMPORTING

OUTPUT = NUMBER2.

WRITE: / 'Number 1 ', NUMBER,

'Number 2 ', NUMBER2.

Or

for padding Zeros

use FM Conversion_Exit_alpha_Input

and pass the input field in import paramter as input and to get the output from export parameter declare the field of particular length suppose l_output(15) type c.

this will convert 15 input to 0000000000000015

Reward points if useful.

Read only

Former Member
0 Likes
2,674

hi..

may be it is useful...

use conversion exit..

CONVERSION_EXIT_ALPHA_INPUT

if useful please reward....

Read only

Former Member
0 Likes
2,674

hi,

use the FM :CONVERSION_EXIT_ALPHA_INPUT

if found helpful do reward

Read only

0 Likes
2,674

method suggested by Sadiqulla Shaik is the best one and also the simplest

define a variable.

Read only

Former Member
0 Likes
2,674

thanks

Read only

Former Member
0 Likes
2,674

Hi,

Try this,

data:V_Accno(10) type n.

accno = '8889'.

unpack accno to accno

output.

0000008889.

Regards,

S.Nehru.

Read only

Former Member
0 Likes
2,674

Hi,

If the data type of your variable is of type N you need not worry.

It will automatically converted to 0000001450.

Else it is of TYPE C,

Use unpack .

Else.

It is of TYPE P.

Use decimals 0.

Regrads,

Sankar.