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

Problem using read dataset

Former Member
0 Likes
846

Hi experts,

I am having some problems using this code:

do.

     read dataset vg_filenamein into it_upload.

     if sy-subrc <> 0. exit. endif.

     append it_upload.

   enddo.

The point is that after using read dataset sy-subrc = 4. Before of the code above it is done this code:

perform open_dataset using vg_filenamein.


That follows:

form open_dataset using p_dataset.

   open dataset p_dataset in text mode ENCODING DEFAULT FOR OUTPUT.

   if sy-subrc <> 0.

     write: / 'Erro na abertura do arquivo: ', p_dataset.

     stop.

   endif.

endform.     


This form works ok since sy-subrc = 0 after using open dataset. The file that I try to read is in AL11 and the path using from open dataset is correct

as well as the file is not empty and this file is just plain text.


Could you please help me?



1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
791

You are opening dataset for output but later you use read command probably that's the reason.

regards,

Bartek

3 REPLIES 3
Read only

Former Member
0 Likes
792

You are opening dataset for output but later you use read command probably that's the reason.

regards,

Bartek

Read only

former_member196331
Active Contributor
0 Likes
791

There are Two standard Programs.

RC1TCG3Y or RC1TCG3Z

One is for Uploading and other one is for downloading.

First try to download the file by using the above one. give the exact path(file), what you tried in the above program. Then check it. whether the path is wrong or some other reason you can get easily.

Hope you understood.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
791

You opened the dataset FOR OUTPUT and then try to read it?

Regards,

Raymond