[ABAP] Datumsfeld auf Gültigkeit prüfen

Variante 1 (check_date)

TRY.
    cl_reca_date=>check_date( CONV d( '01.01.1999' ) ).

  CATCH cx_root INTO DATA(e1).
    WRITE: / e1->get_text( ).
ENDTRY.

TRY.
    cl_reca_date=>check_date( CONV d( '19990101' ) ).

  CATCH cx_root INTO DATA(e2).
    WRITE: / e2->get_text( ).
ENDTRY.

TRY.
    cl_reca_date=>check_date( CONV d( '1234' ) ).

  CATCH cx_root INTO DATA(e3).
    WRITE: / e3->get_text( ).
ENDTRY.

Variante 2 (is_date_ok)

IF abap_true = cl_reca_date=>is_date_ok( id_date = sy-datum ).
  WRITE: / 'Ok.'.
ELSE.
  WRITE: / 'Fehlerhaft.'.
ENDIF.

Kommentare sind geschlossen.