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

Leading zeros.

Former Member
0 Likes
1,002

Hi,

Can any one please tell me how we will add leading zeros to a field.

I was declared the field field(10) type c, in internal table.

Now i upload the data from flat file to IT.

in flat file the value is '1254367'

Now for this field i want to add leading zeros.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
959

use Fm conversion_exit_alpha_input

Hi,

Can any one please tell me how we will add leading zeros to a field.

I was declared the field field(10) type c, in internal table.

Now i upload the data from flat file to IT.

in flat file the value is '1254367'

Now for this field i want to add leading zeros.

Thanks in advance.

8 REPLIES 8
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
960

use Fm conversion_exit_alpha_input

Read only

prasanth_kasturi
Active Contributor
0 Likes
959

Hi,

insted of char take it as numc.

data : field(10) type n.

or use the function module 'CONVERSION_EXIT_ALPHA_INPUT'

data : field(10) value '12345'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = field

IMPORTING

OUTPUT = field.

write : field.

regards

prasanth

Read only

Former Member
0 Likes
959

Declare it like this

field field(10) type N

Ankesh

Read only

Former Member
0 Likes
959

Hi,

Please use FM CONVERSION_EXIT_ALPHA_INPUT to add leading zero's to the field.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
959

Hi,

use the FM "CONVERSION_EXIT_ALPHA_INPUT".

loop at itab.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = itab-fldname

IMPORTING

OUTPUT = itab-fldname

.

modify itab.

endloop.

After this your internal table will have values appended with zeros.

Regards,

Yellappa.

Read only

Former Member
0 Likes
959

hii

you can use

ls_data-matnr = ls_excel-value.
        w_matnr    = ls_data-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = w_matnr
          IMPORTING
            output = w_matnr.

        ls_data-matnr  = w_matnr.

thx

twinkal

Read only

Former Member
0 Likes
959

hi PB,

catch d value in a local char10 variable. then check its length with strlen. if value is 1234567 den length will b 7. den concatenate '000' local var into internal table field.

hope ur problem is resolved.

plz assign points if it is helpful.

rgds,

Avijit

Read only

Former Member
0 Likes
959

Hi,

goto the domain of the field you are using, check if there is any conversion exit, use appropriate conversion_exit_XXXX_input

to convert into internal format.

Thanks,

Keerthi.