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

Conversion exit for field KUNNR

Former Member
0 Likes
6,829

Hi All,

I want to convert the customer number from external format to internal format.(i.e) to add leading zeros to make it to 10 characters.

I tried using the conversion exit 'CONVERSION_EXIT_ALPHA_INPUT' which is attached to the domain KUNNR but the output value is of length more than 10 characters.

Please let me know the proper conversion exit to be used.

Regards,

Sivasubramanian

5 REPLIES 5
Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
2,914

Hi,

I tried this FM and it is working fine. It is giving only 10char in the output also.

DATA: l_kunnr type kunnr value '9123',

l_kunnr1(10) type c.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = l_kunnr

IMPORTING

output = l_kunnr.

l_kunnr1 = l_kunnr.

write:/ l_kunnr1.

Hope this will help u.

Keerthi

Edited by: Keerthy K on Mar 4, 2009 1:23 PM

Read only

Former Member
0 Likes
2,914

You can use do and enddo loop to add the number of zeroes how much you want...

n = number of characters

Do n times

concatenate '0' with the field.

enddo .

Read only

former_member632729
Contributor
0 Likes
2,914

Hi Dude,

For any field you want to find out the conversion rotine : Process is :

first go to the data element -> domain their u will find the converion rotine at definition tab..If you find any rotine then double click that you will find the FM..

CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal

CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external

Read only

Former Member
0 Likes
2,914

The simplest way to do this :

REPORT test.

DATA: kunnr type char10 value '1234'."Use type char10 instead of KUNNR


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = kunnr
 IMPORTING
   OUTPUT        = kunnr
          .
write:kunnr.

Read only

Former Member
0 Likes
2,914

Hi,

things to remember while using this FM.

1) all the characters of kunnr must be in numbers.

2) if their are any alphabates . this FM do not work.