Application Development 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: 

need a function module can get rid of the "0" before a "char" or "NUM"

Former Member
0 Kudos

Hi,

Do someone know a function module can get rid of the meaningless "0" before a "char" or "NUM"?

like:

if the char or num is like "000000hello"

i need it change into "hello"

Please help me out.

thanks in advance.

Message was edited by:

ke tang

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Tang,

Try this.

DATA : CHAR(10) VALUE '000000123'.

TRANSLATE CHAR USING '0 '.

CONDENSE CHAR.

WRITE : CHAR.

or

data:num(5) type n,char(5) type c.

num = 120.

write num to char no-zero.

write: num,char.

Reward if Useful.,

Regards,

Chitra

7 REPLIES 7

Former Member
0 Kudos
Hi Tang,

  try these

REPORT YCHATEST2.

DATA : V_CHAR(10) VALUE '000123456'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
    INPUT  = V_CHAR
  IMPORTING
    OUTPUT = V_CHAR.

WRITE : V_CHAR.



OR


REPORT YCHATEST2.

DATA : V_CHAR(10) VALUE '000123456'.

TRANSLATE V_CHAR USING '0 '.
CONDENSE V_CHAR.

WRITE : V_CHAR.

0 Kudos

these two are really great. problem solved.

You are really great too, thanks very much.

Former Member
0 Kudos

Try this..

data:

w_num(5) type n,

w_chr(5) type c.

w_num+2(3) = 120.

write w_num to w_chr no-zero.

write: w_num,

w_chr.

Former Member
0 Kudos

Hi Tang,

Try this.

DATA : CHAR(10) VALUE '000000123'.

TRANSLATE CHAR USING '0 '.

CONDENSE CHAR.

WRITE : CHAR.

or

data:num(5) type n,char(5) type c.

num = 120.

write num to char no-zero.

write: num,char.

Reward if Useful.,

Regards,

Chitra

Former Member
0 Kudos

Thank you all. your solutions are all really great and appreciate.

Message was edited by:

ke tang

Former Member
0 Kudos

thanks

0 Kudos

What about

SHIFT wa_char LEFT DELETING LEADING '0'.

Cheers

Graham Robbo