Exception classes for DATASET 

CX_SY_FILE_OPEN 

Cause: File is already open (only in Unicode programs) 

Runtime Error: DATASET_REOPEN 

CX_SY_CODEPAGE_CONVERTER_INIT 

Cause: The desired conversion is not supported. (Due to specification of invalid code page or of language not supported in the conversion, with SET LOCALE LANGUAGE.) 

Runtime Error: CONVT_CODEPAGE_INIT (catchable) 

CX_SY_CONVERSION_CODEPAGE 

Cause: Internal error in the conversion. 

Runtime Error: CONVT_CODEPAGE (catchable) 

CX_SY_FILE_AUTHORITY 

 Cause: No authorization for access to file 

Runtime Error: OPEN_DATASET_NO_AUTHORITY (catchable) 

CX_SY_PIPES_NOT_SUPPORTED  

Cause: Authorization for access to this file is missing in OPEN DATASET with addition FILTER. 

Runtime Error: OPEN_PIPE_NO_AUTHORITY (catchable) 

 CX_SY_TOO_MANY_FILES 

 

 

SAMPLE:

 

* local data declaration
  DATA:
  lo_cxfo TYPE REF TO cx_sy_file_open ,
  lo_cxcp TYPE REF TO cx_sy_codepage_converter_init ,
  lo_cxcc TYPE REF TO cx_sy_conversion_codepage ,
  lo_cxfa TYPE REF TO cx_sy_file_authority ,
  lo_cxpn TYPE REF TO cx_sy_pipes_not_supported,
  lo_cxmf TYPE REF TO cx_sy_too_many_files
  .
*--------------------------------------------------------------------*
  
    TRY.

         CONCATENATE v_path_file_descarga '/' sy-datum v_time '.txt' INTO w_ruta.

        OPEN DATASET w_ruta FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

        LOOP AT gt_figl_joined INTO wa_figl_joined.
          TRANSFER wa_figl_joined TO w_ruta .
        ENDLOOP.
     

        CLOSE DATASET w_ruta.

     

      CATCH cx_sy_file_open INTO lo_cxfo.
        WRITE/'Error at open file'.

        CLOSE DATASET w_ruta.

      CATCH cx_sy_codepage_converter_init INTO lo_cxcp.
        WRITE/'Error Code Page Converter initialization'.

        CLOSE DATASET w_ruta.

      CATCH cx_sy_conversion_codepage INTO lo_cxcc.
        WRITE/'Error Code Page Concersion'.

        CLOSE DATASET w_ruta.

      CATCH cx_sy_file_authority INTO lo_cxfa.
        WRITE/'Error no authorization to process file'.

        CLOSE DATASET w_ruta.

      CATCH cx_sy_pipes_not_supported INTO lo_cxpn.
        WRITE/'Error at open file'.

        CLOSE DATASET w_ruta.

      CATCH cx_sy_too_many_files INTO lo_cxmf.
        WRITE/'Error al tratar de procesar muchos archivos'.

        CLOSE DATASET w_ruta.


    ENDTRY.

Software Factory 2