‎2008 Feb 19 8:52 AM
Hi All,
I have to read a file from application server. Record length of that file is 306. I have uploaded the file using tocde: CG3Z successfully. i'm able to view complete record in al11.
but when im trying to read that file into a string of length: 306, failing to do so.. im able to read the record upto length: 125.
data: l_str(306) type c,
l_mesg(100) type c,
l_count type i.
*-- To Open File for Reading
open dataset g_path for input in text mode encoding default.
if sy-subrc <> 0.
message e000 with 'File does not exist'(008) g_path.
g_error = c_x.
endif.
if g_error = space.
*-- Loop thru the UNIX file adding each record
do.
read dataset g_path into l_str.
if sy-subrc <> 0.
exit.
endif.
can anyone suggest me as how to read complete record...
Thanks in advance.
‎2008 Feb 19 9:00 AM
Hello,
Check this. There is a Possiblity to assign the length of the record.
Effect
The actual length of the data objet read is plaed in the field len after the read access. len must be defined as a variable. A syntax error will occur if you define it as a constant.
Example
DATA:
len TYPE i,
text(30) TYPE c VALUE 'Beethoven',
dir(30) TYPE c VALUE '/usr/test.dat'.
OPEN DATASET dir IN TEXT MODE.
TRANSFER text TO dir.
CLOSE DATASET dir.
OPEN DATASET dir IN TEXT MODE.
READ DATASET dir INTO text LENGTH len.
CLOSE DATASET dir.
WRITE: / text, len.
len now contains the value 9.
Cheers,
Vasanth