02-24-2009 4:30 PM
Hi all,
I have a requirement where I have to do prefix zeros to material number t o make it standard 18 digit format.
I am getting the value of MAT_NO from an XML file and it is 678. but I need to make it u2018000000000000000678u2019.
If my material no is u20181u2019 I need to make it u2018000000000000000001u2019
If my material no is u20184272323u2019 I need to make it u201800000000004272323u2019.
My material number is not constant and is dynamic and I need to make it to standard 18 digit format by prefixing with zeros.
Do we have a Key word in ABAP to achieve this?
Any help will be highly appreciated.
Regards,
Jessica Sam.
02-24-2009 4:37 PM
02-24-2009 4:38 PM
shift ur_matnr to right deleting trailing spaces.
overlay '000000000000000000'.
or
use FM of alpha_exit_output
or
just move ur_matnr to a numeric field, say numeric_matnr
then again move this numeric_matnr to ur_matnr (assuming ur_matnr is a CHAR field)
like there r many options.
thanq
02-24-2009 5:06 PM
Hi,
Use: TYPE N
Data: w_matnr(18) type N.
w_matnr = Mat_no.
Write w_matnr.
If Mat_no = 20.
Output:0000000000000000020
Hope this resolves the problem.
Regards,
Gurpreet
02-24-2009 6:19 PM
Solved..thanks for help ..I used following code and it helped.
Thanks to all people for immediate help
Data: a(18) TYPE n.
a = '56'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = a
IMPORTING
OUTPUT = a
.
WRITE: a.