Then how can we check whether date is valid? Just use the function module
DATE_CHECK_PLAUSIBILITY to check the date is valid or not.
 
 
*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: g_date TYPE sy-datum.
*&---------------------------------------------------------------------*
*& Start Of Selection
*&---------------------------------------------------------------------*
START-OF-SELECTION.
  g_date = '99999999'.

*Check whether Date is valid
  CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
    EXPORTING
      date                      = g_date
    EXCEPTIONS
      plausibility_check_failed = 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.
 
 
 
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Consultant
Contact : serkurumsal@yandex.com