Reading and Writing a text file
from and to the application server
* sy-subrc = 0
Record read from file
* sy-subrc = 4
End of file reached
data: w_dataset1(27) value '/var/textfile.txt',
w_dataset2(27) value '/var/outfile.txt'.
data:begin of itab1 occurs 0,
"Text file format
matnr(18), "MATERIAL NUMBER
bwkrs(4), "PLANT
end of itab1.
*Uploading of text file from Application
server.
open dataset w_dataset1 for input in text mode.
do.
if sy-subrc <> 0.
exit.
endif.
read dataset w_dataset1 into itab1.
append itab1.
clear itab1.
enddo.
close dataset w_dataset1.
*Downloading of text file to Application
server.
open dataset w_dataset2 for output in text mode.
loop at itable.
transfer itable to w_dataset2.
endloop.
close dataset w_dataset2.
More Function Module
Functions / SAP
Script / ALV
Tables
Database Table
ABAP Books List
ABAP/4 Certification,
Programming, Smartforms, Sapscripts and Object Oriented Programming Books
Smart Forms
SAP Smartforms
ABAP Menu:
ABAP Example Hints
and Tips
Return to Index:-
SAP ABAP/4 Programming,
Basis Administration, Configuration Hints and Tips
(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
All product names are trademarks of their respective
companies. The site www.gotothings.com is in no way affiliated with
SAP AG.
Any unauthorised copying or mirroring is prohibited.
|