This snipplet tests for not equal 0
:
INSERT reservation_wa INTO TABLE reservation_tab.
IF sy-subrc <> 0.
CONCATENATE license_plate ' reserved!' INTO mess.
MESSAGE mess TYPE 'I'.
ELSE.
MESSAGE 'internal error!' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ENDIF.
I always prefer to test for equality (that's easier to read). The similar coding for your code:
INSERT reservation_wa INTO TABLE reservation_tab.
IF sy-subrc = 0.
MESSAGE 'internal error!' TYPE 'I' DISPLAY LIKE 'E'.
LEAVE PROGRAM.
ELSE.
CONCATENATE license_plate ' reserved!' INTO mess.
MESSAGE mess TYPE 'I'.
ENDIF
In plain text: If the insert is successful (return code == 0), then report an error. If the insert is not successful, then inform about the correct reservation.
I don't know your exact requirement, but it seems you mix up the if/else branch in your code.