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

Read dataset problem

Former Member
0 Likes
627

Hi,

I have a dataset and want to read this dataset data into an attachment itab, however i see that i write all of data into dataset

but i could not read all data into attachment.

What could be the reason?

In sm69 trans i see that file is correctly, even there are blanks lines, written but when tried to read the same file,

i just can get the half of data or a little more.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
597

do you have what is the size of the dataset you are writing out to?

is it big enough?

5 REPLIES 5
Read only

Former Member
0 Likes
598

do you have what is the size of the dataset you are writing out to?

is it big enough?

Read only

0 Likes
597

Hi,

it is a file,

data: filename type string.

and used it like that:

filename becomes : /tmp/03072009.txt

open dataset filename for output in TEXT MODE ENCODING UTF-8.

and every encoding statement i have tried:

open dataset filename for output in TEXT MODE ENCODING UTF-8.

"legacy text mode.

"LEGACY text mode."

"ENCODING NON-UNICODE."UTF-8.

Here is ok, no problem in writing into file.

Problem is at reading the file:

and attch is like that:

data : attch like SOLISTI1 occurs 10 with header line.

open dataset filename for INPUT in BINARY MODE.
                       "TEXT MODE ENCODING UTF-8.
                      "binary mode.
                      "ENCODING  UTF-8 
 refresh attch.
 do.
  clear attch.
  read dataset filename into attch.
  if sy-subrc <> 0.
    CONCATENATE attch con_cret INTO attch.
   append attch.
   exit.
  endif.
  CONCATENATE attch con_cret INTO attch.
  append attch.
 enddo.

*

Thanks.

Read only

0 Likes
597

Try:

OPEN DATASET filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
REFRESH attch.
DO.
  CLEAR attch.
  READ DATASET filename INTO attch.
  IF sy-subrc = 0.
    CONCATENATE attch con_cret INTO attch.
    APPEND attch.
  ELSE.
    EXIT.
  ENDIF.
ENDDO.

Rob

Read only

Former Member
0 Likes
597

How you are doing it?

Are you doing like

data: rec(5000).

open dataset file1 for input in text mode.

if sy-subrc eq 0.

do.

read dataset file1 into rec.

if sy-subrc eq 0.

<add to itab>

else.

exit.

endif.

enddo.

endif.

Edited by: Sam m on Jul 3, 2009 4:19 PM

Read only

Former Member
0 Likes
597

Hi,

Please check while opening the file, whether the file is opened properly or not.

I mean the SY-SUBRC = 0, after the OPEN DATASET command, it indicates that the file is opened properly for reading.

Lets say if it not equal to 0 here, then may be file is not existing or no authorization etc..

Now in degugging check the contents in the internal table, whether it got populated or not properly.

If everything is correct here, then the problem could be, after populating the final internal table, while downloading the data, some thing must have done incorrectly.

If the file data is more, then while transferring it to intenal table itself will give you the dump.

Regards,

Nangunoori.