‎2010 Jul 14 4:27 PM
Dear Friends,
Please suggest me how to add zeros before the material using functional module?
i have mateial of length 18 character
now i have material as "MCV23456" which is 8-digit,my requirement is to add addtional zeros before the
material.
INPUT=MCV23456
OUTPUT=0000000000MCV23456.
Please suggest suitable Functional Module
Thanks in advance
Jai
‎2010 Jul 14 4:33 PM
‎2010 Jul 14 4:34 PM
Hi
I already tried this FM is used for only mumeric values
Regards
Jai
‎2010 Jul 14 4:39 PM
Hi,
You can try the same function module "CONVERSION_EXIT_ALPHA_INPUT".
If this is only working for numeric values, then declare a temporary variable with type numeric and pass the value to temporary variable and use that in function module.
Regards,
Venkat
‎2010 Jul 14 6:34 PM
Come on guys, really? 3 people suggested CONVERSION_EXIT_ALPHA_INPUT for a mixed alpha-numeric field value? I guess BP is the only one paying attention today.
I just have to ask: why would you zero-fill a mixed field anyway?
‎2010 Jul 14 6:37 PM
‎2010 Jul 14 4:36 PM
There are different ways of doing this.. Call the Function Module "CONVERSION_EXIT_ALPHA_INPUT" or user Overlay like this.
DATA: matnr TYPE matnr.
matnr = '12345'.
SHIFT matnr RIGHT deleting TRAILING space.
overlay matnr WITH '000000000000000000'.Correct the code
‎2010 Jul 14 10:50 PM
>
> There are different ways of doing this.. Call the Function Module "CONVERSION_EXIT_ALPHA_INPUT" or user Overlay like this.
>
>
DATA: matnr TYPE matnr. > matnr = '12345'. > SHIFT matnr RIGHT deleting TRAILING space. > overlay matnr WITH '000000000000000000'.>
> Correct the code
Ramesh has the answer, but, like Brad I am wondering why you would ever want to do this. Can you enlighten us?
‎2010 Jul 14 4:37 PM
MCV23456 which is 8-digit
I see three characters that are not digits...Are you sure you need to do this? Material is an alpha field!
However, if you look at the domain for MATNR, you'll see that there is a conversion routine MATN1...But it doesn't shift and left zero fill...
‎2010 Jul 14 10:57 PM
>
>
MCV23456 which is 8-digit
>
> I see three characters that are not digits...Are you sure you need to do this? Material is an alpha field!
>
> However, if you look at the domain for MATNR, you'll see that there is a conversion routine MATN1...But it doesn't shift and left zero fill...
Man! you are just too literal. You probably correct people who use o instead of 0 when saying a number. Like 1"o" 4 5 instead of 1 "zero" 4 5. We all know what is meant even though it is not literally correct
‎2010 Jul 14 9:16 PM
Hi,
You can use CONVERSION_EXIT_MATN1_INPUT.
Every time you need to see what conversion function a field is using go to SE11->Domain (MATNR in this case)->double click on "Convers. Routine". You will get the list of INPUT/OUTPUT FM's used in the conversion for this domain.
‎2010 Jul 14 10:04 PM
No, you can't by default...read the question and look at the value. MATN1 does nothing when the value contains alphas unless you force it by implementing BADI BADI_MATN1 or the old style enhancement provided...Configured material templates don't fire for non-numeric values either as far as I know.
You can implement some wacky code in the BADI to get that result though - don't know why you would want to anyway...
‎2010 Jul 14 10:14 PM
Hi,
If you use CONVERSION_EXIT_ALPHA_INPUT for mixed values then the result is going to be material+spaces, using this external to internal converison f.m it adds leading zeros for numeric material only. if the material is going to be mixed value then you can calculate the length of the material and move 18 - length as leading zeros to new 18 character field followed by material.
Regards,
Manjunath