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

need to put procedding zero before a number

Former Member
0 Likes
1,605

hi

i wnat to put zero digit bofre a number which is coming in a variable...pls sugest for that

do we use concatenate or i dont want to use alpha input etc functionon module only one zero i want to put not all empty space to zero

so pls suggest how to put a zero before a number

egang;e number in varialbe as comiing is 587

i want it like to be 0587 ie zero in fron of it

rgds

arora

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,537

hi,

Try the below code and reward accordingly.

DATA: var(10) TYPE c.

MOVE '587' TO var.

CONCATENATE '0' var INTO VAR.

Regards,

Prasanna

hi

i wnat to put zero digit bofre a number which is coming in a variable...pls sugest for that

do we use concatenate or i dont want to use alpha input etc functionon module only one zero i want to put not all empty space to zero

so pls suggest how to put a zero before a number

egang;e number in varialbe as comiing is 587

i want it like to be 0587 ie zero in fron of it

rgds

arora

9 REPLIES 9
Read only

Former Member
0 Likes
1,537

data:accno(10) type n.

accno = '1405'.

unpack accno to accno.

OR

Declare the variable type N.

ex: v_amt(10) type n.

pass the value to v_amt.

Or

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

Reward points..

Read only

0 Likes
1,537

hi murali

as i told i dont want to use this FM as it put leading zeros in front i want only single zeroo not leading zeros

regards

Nishant

Read only

Former Member
0 Likes
1,537

Hi Nishant,

the easiest way is declare it of type N

data : var(4) TYPE N.

Read only

Former Member
0 Likes
1,537

Hi,

option 1.

concatenate '0' '8' into variable name.

option2.

declare a vairable like below.

data: myvar(2) type n.

move: '8' to myvar.

now my var will be 08

Regards

Kiran Sure

Read only

0 Likes
1,537

hi all

my restrictio nis to declare the varialble type C

and i want to put a leading zero in front of values in the varialbel

fir egh variable has valure

659

i want to pass it further as 0659

pls suggest

Read only

Former Member
0 Likes
1,538

hi,

Try the below code and reward accordingly.

DATA: var(10) TYPE c.

MOVE '587' TO var.

CONCATENATE '0' var INTO VAR.

Regards,

Prasanna

Read only

0 Likes
1,537

hi

i suppose u are not getting my point

i have a varialbe say var1 it has value 567

i want to put a leading zero infront of this value ONLY

now after puting leading zero the var1 is = 0567

and concetenate doesentl work as var1 is a char field it give error

pls suggest

Read only

0 Likes
1,537

Hi ,

Send the declarations which you have done.

so that i can test before posting the solution.

See the code i sen works fine in my system.

And var variable in my last post is defined as char type only, you can have a one more look at it.

Regards,

prasanna

Read only

Former Member
0 Likes
1,537

Hi Arora,

Proceed as follows.


DATA: v_cout TYPE charn.  "Here replace 'n' by any number say char20

v_cout = '123456'.

CONCATENATE '0' v_cout INTO v_cout.

WRITE:/ v_cout.

Now the output gets displayed as 0123456.

If this doesn't work out then send me your code so that I can modify the same and send it back to you.

Reward accordingly.

Thanks and Regards,

Maddineni Bharath.