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

Convert from numc to string

Former Member
0 Likes
3,964

Hello everybody,

i have a numeric Data object and want to convert it to string. Now i have the Problem, that i get for a numeric with 6 characters After a direct assignment 000005, but my aim is only 5. How can i convert it without figure Zero?

Regards!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,075

DATA:num(6)  TYPE n VALUE '000005'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
    input         = num
 IMPORTING
   OUTPUT        = num.


write num.
6 REPLIES 6
Read only

alex_cook
Active Participant
0 Likes
2,075

Howdy,

If you string variable name is l_string, try something like:

SHIFT l_string left deleting leading '0'.

Cheers

Alex

Read only

Former Member
0 Likes
2,075

Hi,

Use FM 'CONVERSION_EXIT_ALPHA_OUTPUT'

Thanks,

Hemant

Read only

venkat_o
Active Contributor
0 Likes
2,075

Hi, <li>Try this way .

REPORT ztest_notepad.

DATA:num(6)  TYPE n VALUE '000005'.
DATA:char(6) TYPE c.
DATA:str     TYPE string.

char = num.
WRITE char to char no-ZERO.
str = char.

WRITE str.
Thanks Venkat.O

Read only

Former Member
0 Likes
2,075

Hi Gerrit,

FM- 'CONVERSION_EXIT_ALPHA_OUTPUT'

Regards,

Amruta

Read only

Former Member
0 Likes
2,075

hi gerrit,

you can use FM 'CONVERSION_EXIT_ALPHA_OUTPUT'


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
    input  = vekp-exidv  " put your field which have zeros
  IMPORTING
    output = xv_vhilm_ku. " u will get value without zero

after getting the value convert it to string.

hope this will help

thanks

tanmaya

Read only

Former Member
0 Likes
2,076

DATA:num(6)  TYPE n VALUE '000005'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
    input         = num
 IMPORTING
   OUTPUT        = num.


write num.