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: 

padding zeros.

Former Member
0 Kudos

Hi All!

I have a situation where in i will be having a value like

1234909098

and i have to pad eight zeros in front of it like below

000000001234909098

Any FM to achieve this or any simple code to get this .

Regards

Praneeth

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Hi,

check this code..

REPORT  ZTEST_APLHA                             .
data: text(18).

text = '1234909098'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = text
 IMPORTING
   OUTPUT        = text
          .

write text.

Regards

Vijay

6 REPLIES 6

Former Member
0 Kudos

hi

use converion exit here:

CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal

CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external

else

move it to string and then concatenate the zeros if u knwo the exact no of them...

reward points if it helps

gunjan

Former Member
0 Kudos

Hi

If the value is data object of a standard table, then check out the conversion rule for the object.

For instance, MATNR conversion rule is ALPHA and to pad zero's a FM called CONVERSION_EXIT_ALPHA_OUTPUT is used.

Navneet

PS: Please mark the helpful answers.

former_member188685
Active Contributor
0 Kudos

Hi,

check this code..

REPORT  ZTEST_APLHA                             .
data: text(18).

text = '1234909098'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = text
 IMPORTING
   OUTPUT        = text
          .

write text.

Regards

Vijay

Former Member
0 Kudos

Hi,

Try FM CONVERSION_EXIT_ALPHA_INPUT.

Regards,

Aswin

andreas_mann3
Active Contributor
0 Kudos

hi,

try fm LINEITEM_ALPHAFORMAT

Andreas

0 Kudos

data: a(10) type p value '1234909098'.

data: b(10) type c value '1234909098'.

data: c(18) type n.

move a to c.

write:/ c.

move b to c.

write:/ c.