cancel
Showing results for 
Search instead for 
Did you mean: 

how to give ouput parameter for this function CONVERSION_EXIT_ALPHA_INPUT

Former Member
0 Kudos

Hi Experts,

Good day to all. .

I am using the function module CONVERSION_EXIT_ALPHA_INPUT predefined function module if i am giving the parmeter as database filed type integer means its giving the correct out put as shown in sample program.

if i am giving the parmeter as database filed type as char its not giving the output correctly and getting the output as what i am giving as input.

sample prog:

data: input type Mseg-mblnr value '23', OUT(18) type C.

(or)

data: input OUT type Mseg-MAT_KDPOS value '23', OUT type Mseg-MAT_KDPOS.( for this o/p 000023)

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = input

IMPORTING

OUTPUT = OUT.

write:/ out.

now its giving the output correctly

o/p: 000000000000000023 ( length is 18 so its adding 16 0's and actual value 23)

data: output type mara-matnr value '23', OUT type mara-matnr.

it giving the output as 23 but i need the output as previous

could any one please give the solution for this

Accepted Solutions (1)

Accepted Solutions (1)

former_member156446
Active Contributor
0 Kudos

this FM doesn't work as you expected.

FM documentation with example:

Conversion exit ALPHA, external->internal

ALPHA conversion is used especially with account numbers. During conversion from the externa
l to the internal format, the system checks to see if input in the INPUT field is purely numeric, that 
is, if this input consists only of numbers, possibly with spaces before and after them. If this is the 
case, then the number string is inserted right- justified in the display field OUTPUT and all spaces 
to the left of the value are filled with zeroes ('0'). If the input is not purely numeric, it is inserted in 
the display field from left to right and all extra spaces are filled with blanks.

Example:

(Input field and output field are both eight characters in length)

1. '1234    ' --> '00001234'
2. 'ABCD    ' --> 'ABCD    '
3. ' 1234   ' --> '00001234'

Conversion from the internal to the external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) 
is undertaken in exactly the opposite manner.

Former Member
0 Kudos

HI ..

First of all thanks for the immed response from your end.

My input is 25 .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = output

IMPORTING

OUTPUT = OUT.

For output variable data declaration is

data: out type mara-matnr. if i declare i like this i am getting a same input value . (like 25 only).

if i declaring the variable data: out (20) type c. it giving the answer leaded with 18 zeros.

why is it like this kindly clarify.

Regards

Thaneesh

former_member156446
Active Contributor
0 Kudos

if you want to convert Matnr you need to use:

CONVERSION_EXIT_MATN1_RANGE_I  Conversion Exit MATN1, External Range -> Internal Range
CONVERSION_EXIT_MATN1_RANGE_O  Conversion Exit MATN1, Internal Range -> External Range

Read the function module documentation carefully.. it depends on the data thats in the field..

Answers (1)

Answers (1)

Former Member
0 Kudos

Example program for this function module

data lt_mara TYPE ZMATNR_TEST. " gobal table type

data lt_mara_chang TYPE zmatnr_test.

data ls_mara LIKE LINE OF  lt_mara.

TYPES : BEGIN OF ty_mara,

   material type matnr,

   END OF ty_mara.

  

data ref_matnr TYPE matnr.

data res_material TYPE matnr..

ls_mara-SIGN = 'I'.

ls_mara-option = 'EQ'.

ls_mara-LOW = '19283'.

APPEND ls_mara to lt_mara.

ref_matnr = '000000000000001203'.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_RANGE_I'

   EXPORTING

     input           = ref_matnr

  IMPORTING

    OUTPUT          = res_material

   tables

     range_int       lt_mara_chang

     range_ext       =   lt_mara

           .

BREAK-POINT.