DATA ls_return TYPE bapireturn.
CALL FUNCTION 'BAPI_EMPLOYEE_CHECKEXISTENCE'
EXPORTING
number = 99999999
IMPORTING
return = ls_return.
IF ls_return-type = 'E'.
MESSAGE ls_return-message TYPE ls_return-type.
ENDIF.
On newer systems there is also class CL_HRPA_MAINTAIN_EMPLOYEE
with method PERSONNEL_NUMBER_EXISTS
.
Or class CL_HRPA_MAINTAIN_EMPLOYEE_UTIL
and method EXIST_EMPLOYEE
.