Hello Enrique Aguirre.
Check whether preceding zeroes are there in MATNR that you are passing to BAPI?
If not, use FM CONVERSION_EXIT_ALPHA_INPUT to pad preceding zeroes.
This you could have avoided if you had declared MATNR like below:
BEGIN OF LSMW_MATERIAL_MASTER,
MATNR(018) TYPE C, "Material number
MATNR type MATNR, "Material Number
By this way of declaration, automatically zeroes will be padded up.
As possible, declare variables with reference to standard table-field (like MARA-matnr) or standard data element (MATNR).
Regards.