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

padding zeros.

Former Member
0 Likes
785

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
Read only

Former Member
0 Likes
734

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
Read only

Former Member
0 Likes
734

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

Read only

Former Member
0 Likes
734

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.

Read only

Former Member
0 Likes
735

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

Read only

Former Member
0 Likes
734

Hi,

Try FM CONVERSION_EXIT_ALPHA_INPUT.

Regards,

Aswin

Read only

andreas_mann3
Active Contributor
0 Likes
734

hi,

try fm LINEITEM_ALPHAFORMAT

Andreas

Read only

0 Likes
734

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.