2005 Aug 22 1:22 PM
Hi All,
I need to create one file with extension ".dat" on Application server. I hv no clue how should I proceed with this.
I just know We can use OPEN DATASET to create, read & write into files on Application server.
How could we deal about extension of these files?
Thanks in advance.
Prasad
Hi All,
I need to create one file with extension ".dat" on Application server. I hv no clue how should I proceed with this.
I just know We can use OPEN DATASET to create, read & write into files on Application server.
How could we deal about extension of these files?
Thanks in advance.
Prasad
2005 Aug 22 1:32 PM
Here is an example of copying a file on the backend.
Notice the extensions.
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/Data2.dat'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
Regards,
Rich Heilman
2005 Aug 22 5:51 PM
Hi Prasad,
Filename (including extension) doesn't really matter for these statements, you can choose whatever extension you want. Example given above is a good starter. Please pay attention to the "mode" used for opening dataset/file. Choose the one that meets your requirement. I feel you should use "binary" mode.
Cheers,
Sanjeev
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |