Application Development 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: 

After connecting to FTP

Former Member
0 Kudos
125

Hi all,

After connecting to FTP.

I want to read the data into an internal table which is in location for eg:- /export/home/in/text.txt

The question is "How can i get all the data which is available in text.txt file to an internal table??"

Note: I am aware of FMs ftp_connect, ftp_command, ftp_disconnect. I tried using Open Dataset..but not successful.

I would appreciate if you can give a specific answer with an example.

helpful answer will be rewarded with points.

Thank You in advance.

10 REPLIES 10

Former Member
0 Kudos
96

What happened when you used OPEN DATASET?

Did you also use READ DATASET?

Rob

Former Member
0 Kudos
96

Hi VGP,

Those FM are not required. Simply write one program using open dataset.Use the following in your program.

program zreport1.

data: begin of i_upload occurs 0,

text(1000) type c,

end of i_upload.

selection-screen begin of block blk with frame title text-001.

parameters: fname like rlgrap-filename.

selection-screen end of block blk.

start-of-selection.

if not fname is initial.

perform zf_upload.

endif.

form zf_upload.

open dataset fname for input in text mode.

if sy-subrc <> 0.

message s999 with 'File not found or cannot be opened'.

stop.

endif.

do.

read dataset fname into i_upload.

if sy-subrc <> 0.

exit.

endif.

append i_upload.

clear i_upload.

enddo.

close dataset fname.

endform. " zf_upload

Hope this helps.

Please reward if useful.

Thanks,

Srinivasa

Former Member
0 Kudos
96

Hello,

when i use the Open Dataset..sy-subrc = 8, an exception is raised.

is there any alternative method or we have to use only Open Dataset...?

0 Kudos
96

Hi VGP,

Do you have the permissions or authorizations to open the file?

Hope this helps.

Thanks,

Srinivasa

Former Member
0 Kudos
96

Hi,

I have all the authorizations.

0 Kudos
96

Hi VGP,

If possible can you send me your code?

What is the file name you are using?

Thanks,

Srinivasa

Former Member
0 Kudos
96

Thank You all...I could solve it...

Former Member
0 Kudos
96

Solved on own

0 Kudos
96

Hi VGP,

Please let me know what was the problem. How did you solved it?

Thanks,

Srinivasa

0 Kudos
96

Hi Srinivasa,

I think we can't use open_dataset..., as mentioned in my question the file is in external application server.

I tried using the FM FTP_SERVER_TO_R3.