If SY-SUBRC is equal to '4' then the material in table MARA doesn't exist or the value of wa-basic_data1-matnr is not ready for input and you must convert it.
Sometimes the value of 'MATNR' in table 'MARA' is configured in SAP to use a range to automatically assign the number to materials in the standard transactions 'MM01' and 'MM41'. This behaviour doesn't apply in custom programs, please make sure to use the function modules 'CONVERSION_EXIT_MATN1_INPUT' and 'CONVERSION_EXIT_MATN1_OUTPUT' in this situations.
The data type 'MATNR' is a CHAR(18) and the values (in this case) are stored with zeros at the left although you see the number without those zeros. And that is because SAP internally converts for output the value so the user doesn't see those zeroes.
For example, if the value of MARA-MATNR in transaction 'SE16N' or 'MM03' is '9999999' then the real value stored is '000000000009999999'. Check the same table with transaction 'SE11' and this time you'll see the raw data.
The following code can explain a little better the above:
DATA: lv_matnr TYPE matnr,
wa_mara TYPE mara.
lv_matnr = '1234567'. " -> Not ready for input
SELECT SINGLE * FROM mara INTO wa_mara WHERE matnr eq lv_matnr.
WRITE sy-subrc. " -> sy-subrc = 4. Not found
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' " Format for input
EXPORTING
INPUT = lv_matnr " The value is '1234567'
IMPORTING
OUTPUT = lv_matnr " The value will be formatted to '000000000001234567'
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SELECT SINGLE * FROM mara INTO wa_mara WHERE matnr eq lv_matnr.
WRITE / sy-subrc. " -> sy-subrc = 0. Found
In your case try this;
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = wa-basic_data1-matnr
IMPORTING
OUTPUT = wa-basic_data1-matnr " Add zeroes at the left
EXCEPTIONS
LENGTH_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
UPDATE mara
SET
zzmanu = wa-sales_data2-zzmanu
zzmatnr_sf = wa-sales_data2-zzmatnr_sf
WHERE matnr = wa-basic_data1-matnr.
if sy-subrc eq 0.
commit work.
wait up to 2 seconds.
ENDIF.
Hope it helps