Skip to Content
0
Former Member
Jan 12, 2010 at 03:39 AM

Error :DATASET_NOT_OPEN Except.: CX_SY_FILE_OPEN_MODE

3656 Views

Hello experts

Kindly help me on this... All my scheduled background job were CANCELLED due to this error...

Error analysis: ST22 An exception occurred that is explained in detail below. The exception, which is assigned to class 'CX_SY_FILE_OPEN_MODE', was not caught in procedure "BACKGROUND_JOB" "(FORM)", nor was it propagated by a RAISING clause. Since the caller of the procedure could not have anticipated that the exception would occur, the current program is terminated. The reason for the exception is: When accessing the file "C:\tempfiles\empdata\EmpData20100112.csv", the system recognized that this file is not open. Therefore, the file cannot be accessed.

FORM BACKGROUND JOB CODES:

DATA: LV_BET01 TYPE STRING.

  IF P_TEST EQ 'X'.
    CONCATENATE P_PATH 'EmpData' SY-DATUM 'test' '.csv' INTO V_FILEPATH.
  ELSE.
    CONCATENATE P_PATH 'EmpData' SY-DATUM '.csv' INTO V_FILEPATH.
  ENDIF.

  OPEN DATASET V_FILEPATH FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
  LOOP AT GT_EMP INTO WA_EMP.

    WHILE WA_EMP-NACHN CS ','.
      REPLACE ',' WITH ' ' INTO WA_EMP-NACHN.
    ENDWHILE.

    WHILE WA_EMP-VORNA CS ','.
      REPLACE ',' WITH ' ' INTO WA_EMP-VORNA.
    ENDWHILE.

    WHILE WA_EMP-CARD CS ','.
      REPLACE ',' WITH ' ' INTO WA_EMP-CARD.
    ENDWHILE.

    CONCATENATE
        WA_EMP-PERNR
        WA_EMP-WERKS
        WA_EMP-VORNA
        WA_EMP-NACHN
        WA_EMP-NATIO
        WA_EMP-GBDAT
        WA_EMP-ADD
        WA_EMP-ORT01
        WA_EMP-PSTLZ
        WA_EMP-GESCH
        WA_EMP-CELL
        WA_EMP-EMAIL
        WA_EMP-TEL
        WA_EMP-F_DAY
        WA_EMP-S_DAY
        WA_EMP-PERSG
        WA_EMP-L_GROUP
        WA_EMP-P_GROUP
        WA_EMP-P_GRP_BEG
        WA_EMP-P_GRP_END
        WA_EMP-ORGEH
        WA_EMP-POS_EFF
        WA_EMP-POS_END
        WA_EMP-STELL
        WA_EMP-STELL2
        WA_EMP-PRIM
        WA_EMP-CARD
    INTO V_FILEPATH1 SEPARATED BY ','.

    TRANSFER V_FILEPATH1 TO V_FILEPATH.
  ENDLOOP.
  CLOSE DATASET V_FILEPATH.

PLEASE help me how can i resolved this... Thank you!