Rename file on Application server

form datei_umbenennen using lv_altpfad lv_neupfad type string.
  data: lv_eof_reached   type c,
        lv_buffer(20480),
        lv_buflen        type i.
 
  open dataset lv_altpfad for input in binary mode.
  if sy-subrc ne 0.
    raise open_input_file_failed.
  endif.
 
  open dataset lv_neupfad for output in binary mode.
  if sy-subrc ne 0.
    raise open_output_file_failed.
  endif.
 
  clear lv_eof_reached.
 
  do.
    clear lv_buffer.
 
    read dataset lv_altpfad
            into lv_buffer length lv_buflen.
 
    if sy-subrc = 4.
      lv_eof_reached = 'X'.
    elseif sy-subrc > 4.
      raise read_block_failed.
    endif.
 
    transfer lv_buffer to lv_neupfad
      length lv_buflen.
 
    if sy-subrc ne 0.
      raise write_block_failed.
    endif.
 
    if lv_eof_reached eq 'X'.
      exit.
    endif.
  enddo.
 
  close dataset lv_altpfad.
  close dataset lv_neupfad.
  if sy-subrc <> 0.
    raise close_output_file_failed.
  endif.
 
  delete dataset lv_altpfad.
endform.

Schreibe einen Kommentar



All fields are required. Your email address will not be published.