‎2012 Nov 27 4:56 AM
Hi,
I am shyam. I am creating simple program.
parameter : p_matnr type mara-matnr.
Length of mara-matnr is 18.
During compile time-
i am giving value p_matnr=157.
it is working.
But if i am putting value in program means hard code
p_matnr=157.
i am facing run time error.
its show you gave value less than length.
Please provide me length conversion code.
Thanks and Regrads,
SHYAM.
‎2012 Nov 27 5:05 AM
‎2012 Nov 27 5:05 AM
hi,
in program you must satisfy the field length.
try p_matnr = '000000000000000157'.
because in some of the table entries it will be stored as the above . ex(MSEG)
try.
Regards,
Vinoth Aruldass.
‎2012 Nov 27 5:17 AM
hi,
data : p_matnr type matnr.
p_matnr = '157'
pack p_matnr to p_matnr.
try it works,
regards,
Vinoth Aruldass s.
‎2012 Nov 27 5:39 AM
‎2012 Nov 27 5:51 AM
Hi shyam,
if you do not put the value in quotes(' ') then it is treated as integer.
p_matnr = 157 is integer assignment to character. and integer length is 32 bytes which you are trying to assign to char field of 18 characters. So the dump.
As my friend told please put '000000000000000157'. or use statement. pack p_matnr to p_matnr.
thanks,
‎2012 Nov 27 6:26 AM
put p_matnr = '157' , atleast it wont dump , but still you will not be able to fetch data from database tables . so you need to use CONVERSION_EXIT_MATN1_INPUT to change your p_matnr.
You can always find conversion routine by going into the domain for that field , In definition tab you could see a field Convers. Routine. Hope it helps.
‎2012 Nov 27 7:33 AM
Look for the domain MATNR definition -> There should be a conversion exit (like MATN1), double-click on this field; you get the FM name to convert a material number from external format to internal CONVERSION_EXIT_MATN1_INPUT and from internal to external (as WRITE statement implicitally do) CONVERSION_EXIT_MATN1_OUTPUT.
NB: The right justified, left padded with zero is only valid for ALPHA conversion exit and only if there are only space and a contiguous group of number. (better use CONVERSION_EXIT_ALPHA_INPUT FM in this case) In many SAP solutions, the ALPHA conversion exit is not suitable for material number.
Regards,
Raymond
‎2012 Nov 28 9:54 AM
Hi Shyam,
As other BI experts told, please preceed the value "157" with zeros and this will fix your issue.
Thanks,
Umashankar
‎2012 Nov 28 10:03 AM
Hi,
SHIFT p_matnr RIGHT DELETING TRAILING ' '.
OVERLAY p_matnr WITH '000000000000000000'. " 18 zero's
Regard's
Smruti Ranjan
‎2012 Dec 01 12:29 PM