Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

open data information required?

Former Member
0 Likes
487

Hi

I want to delete the csv file from the application server once the full data set is read.

i am sucessful to read the data set,but while usiong the delete datset,its deleting it,but as next time i am not abale to read any data,but file exits on application server.

please tell me how to delete file physicaly from application server too.

seconding,how to write the data from my tabel to csv file in application server.

my code for deleteing file:

OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

DELETE DATASET file.

CLOSE DATASET file.

code for writing the data to file:

OPEN DATASET file1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  • LOOP AT result.

  • CLEAR:wa1.

  • CONCATENATE result-mat1 ',' result-mat2 ',' result-type ',' result-message INTO wa1.

*

    • TRANSFER wa1 TO file1.

  • IF sy-subrc = 0.

  • ENDIF.

*

  • ENDLOOP.

TRANSFER result TO file1.

CLOSE DATASET file1.

3 REPLIES 3
Read only

Former Member
0 Likes
449

WS_FILE_DELETE - "Delete File at the Frontend or Presentation server file

or

EPS_DELETE_FILE "Application file delete

  • delete file

DELETE DATASET FILE_PATH. "File_path is nothing but appl file name

IF SY-SUBRC <> 0.

RAISE DELETE_FAILED.

ENDIF.

Read only

rainer_hbenthal
Active Contributor
0 Likes
449

The one whos writing the file does not set the correct authorities (chmod).

Read only

Former Member
0 Likes
449

Hi,

For deleteing dataset it is not required to open and close the dataset:

OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
READ DATASET...
CLOSE DATASET file.
DELETE DATASET file.
ENDIF.

For writing the data to file in CSV format you need to use the concatenate statement and to insert the comma between the fields:

OPEN DATASET file1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

 LOOP AT result.
 CLEAR:wa1.
 CONCATENATE result-mat1 result-mat2 result-type result-message INTO wa1 SEPRATED By ','.
 TRANSFER wa1 TO file1.
 ENDLOOP.

CLOSE DATASET file1.