Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Issue in Download file - If the file name is same

$
0
0

Hi Experts,

 

I have a requirement to download the company code hierarchy data into a file. On selection screen I am giving the file path along with the file name If I run the report it is downloading the data into the particular file in the file path this is expected result but if i am running the report with same filename which is already exists in the same path then instead of replacing the file with new data it is appending the data to that file.

 

But my expected result is: If the file name is same, file should be replaced with the Current Data instead of Appending the file.

 

And this issue is happening for the file formats TXT and CSV and also this issue is happening only when i am saving to the local drive.

 

I executed  the report by giving the file name Eg: " XXXX.xls" extension even in this case the records getting replaced with the new data, problem is when the file extension is with TXT and CSV formats.

 

FYI... to download the data i am using the below funtion module and i am passing the below parameters: Please correct me if i am wrong.

 

   CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       FILENAME                        = G_LFILE
       FILETYPE                        = G_FILETYPE
       APPEND                          = 'X'
       WRITE_FIELD_SEPARATOR           = GC_FIELDSEP    " Passing X
       TRUNC_TRAILING_BLANKS           = GC_TRUNCBLNKS " Passing X
       DAT_MODE                        = GC_DATMODE                 "Passing X
       CODEPAGE                        = G_LCODEPAGE

 


      TABLES
        DATA_TAB                        = GT_ITAB_HIER1

 


     EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
              .
    IF SY-SUBRC <> 0.
      G_FNAME = G_LFILE.
      MESSAGE E043(ZFI) WITH G_FNAME.
    ENDIF.

 

 

 

 

 

Can any one please provide me the solution.

 

 

 

Thanks in advance.

Koushik

 

 



Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>