on 11-11-2009 8:17 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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..
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.