[ABAP] Byte Order Mark (BOM) einer Datei auf dem Applikationsserver ermitteln

TRY.
    DATA(lv_file) = '/usr/sap/tmp/file.txt'.

    CASE cl_abap_file_utilities=>check_for_bom( lv_file ).
      WHEN cl_abap_file_utilities=>bom_utf8.
        WRITE: / 'UTF8'.
      WHEN cl_abap_file_utilities=>bom_utf16_le.
        WRITE: / 'UTF16_LE'.
      WHEN cl_abap_file_utilities=>bom_utf16_be.
        WRITE: / 'UTF16_BE'.
      WHEN cl_abap_file_utilities=>no_bom.
        WRITE: / 'No BOM'.
    ENDCASE.

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