Skip to Content
0
Former Member
Jul 31, 2007 at 01:01 PM

temp files

25 Views

Hi all,

I am using a dataset to tempororily store some data in my program. the thing is if my program is executed by multiple users at a same time, the same dataset './mytempfile' is used and everything goes wrong. so suggest me how to overcome this.

 OPEN DATASET './mytempfile' FOR OUTPUT IN BINARY MODE.
  IF sy-subrc EQ 0.
    LOOP AT t_myfile.
      TRANSFER t_myfile TO './mytempfile'.
    ENDLOOP.
    CLOSE DATASET './mytempfile'.
  ENDIF.


  OPEN DATASET './mytempfile' FOR INPUT IN BINARY MODE.
  IF sy-subrc EQ 0.
    DO.
      CLEAR t_mybin.
      READ DATASET './mytempfile' INTO t_mybin MAXIMUM LENGTH 255.
      IF sy-subrc NE 0.
        EXIT.
      ELSE.
        APPEND t_mybin.
      ENDIF.
    ENDDO.
    CLOSE DATASET './mytempfile'.
  ENDIF.


  DELETE DATASET './mytempfile'.
  IF sy-subrc NE 0.
    MESSAGE 'Error when deleting MY file'(008) TYPE 'I'.
    LEAVE LIST-PROCESSING.
  ENDIF.