2006 Sep 22 6:27 AM
How can i create a File on Application Server ?
Please send code for that .
e-mail-- [email protected]
2006 Sep 22 6:35 AM
Hi Krishna Kuamr,
there is a slight change in Pawan's Code to write to an Application Server.
OPEN DATASET <filename> FOR <b>OUTPUT</b> IN TEXT MODE.
LOOP...
TRANSFER <itab> to <filename>
ENDLOOP.
CLOSE DATASET <filename>.
How can i create a File on Application Server ?
Please send code for that .
e-mail-- [email protected]
2006 Sep 22 6:31 AM
Hi krishna,
1. we will have to use
the commands
OPEN DATASET, TRANSFER, CLOSE DATASET
2. Just see F1 help on it.
3. Also note that the filename
to open
is case sensitive in case of UNIX/AIX
application servers.
regards,
amit m.
2006 Sep 22 6:32 AM
<b>CG3Z</b> - Upload a empty file to a application server from presentation server.it create a file in application server.
2006 Sep 22 6:31 AM
hi,
we use OPEN DATASET and CLOSE DATASET commands for creating a file on application server.
u can see them in AL11.
OPEN DATASET <filename> FOR INPUT IN TEXT MODE.
LOOP...
TRANSFER <itab> to <filename>
ENDLOOP.
CLOSE DATASET <filename>.
reward if found useful...
2006 Sep 22 6:32 AM
Hi,
Go thro' the link, this might help,
http://www.sapdevelopment.co.uk/file/file_downloadsap.htm
Rgds,
2006 Sep 22 6:35 AM
Hi Krishna Kuamr,
there is a slight change in Pawan's Code to write to an Application Server.
OPEN DATASET <filename> FOR <b>OUTPUT</b> IN TEXT MODE.
LOOP...
TRANSFER <itab> to <filename>
ENDLOOP.
CLOSE DATASET <filename>.
2006 Sep 22 6:36 AM
2006 Sep 22 6:36 AM
Use OPEN DATASET Stmt.
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.
2006 Sep 22 6:55 AM
Hi,
in first reply i have posted code for reading file from application server.
this code will create file on applicaton server.
in this code i have added "length" statement which is use to catete record when you have no data for the last field. for example you have data in you itab like..
ABC 123 XYX
WER 453 SDF
ASS 577
QWE 321 232
in this situation when you dont have record for the third row, file will be created with blank record.
open file on application server.
open dataset <file name> for output in text mode.
transfer the record first.
transfer itab to <filename> length len.
close the file at Application Server.
close dataset <filename>.
2006 Sep 22 7:04 AM
Use code:
DATA:
dsn(40) VALUE
'\usr\sap\TDV\DVEBMGS00\data\stat.dat',
rec(80).
First use opendataset.
read datset and last close dataset.
OPEN DATASET dsn.
IF sy-subrc = 0.
DO.
READ DATASET dsn INTO rec.
IF sy-subrc <> 0.
EXIT.
ELSE.
WRITE / rec.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET dsn.
2006 Sep 22 7:09 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |