You should use conversion routine.
for example.
if you pass material code as 10.
use conversion routine "CONVERSION_EXIT_MATN1_INPUT"
material code will be 000000000000000010
same as you need to find conversion routine for required field.
-Avirat