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: 

Getting from SAP and transefering AS400 a file

Former Member
0 Kudos

Hello, experts

I'm having a big problem on PRD environment, I need to get a file in source server (SAP) and transfering via FTP to AS400 server, how can I do this??? are there a FM ?

Please It's urgent, any helpfull information I will appreciate it.

Regards

mgg

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Where on the AS400, into the IFS(Integrated File System)? Is this folder on IFS shared out? If so, then it will look like any other folder or directory on the the network, so you could simply use the GUI_DOWNLOAD function to put the file on the AS400 file system. If the source is on the SAP application server, you will need to use the OPEN DATASET statement to load the file in to an internal table of your program. I do not having any experience with FTP in ABAP, so not sure how you would use that.

Regards,

Rich Heilman

5 REPLIES 5

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Where on the AS400, into the IFS(Integrated File System)? Is this folder on IFS shared out? If so, then it will look like any other folder or directory on the the network, so you could simply use the GUI_DOWNLOAD function to put the file on the AS400 file system. If the source is on the SAP application server, you will need to use the OPEN DATASET statement to load the file in to an internal table of your program. I do not having any experience with FTP in ABAP, so not sure how you would use that.

Regards,

Rich Heilman

0 Kudos

Thanks Rich

The scenario is, we have a directory on SAP server wich contains the file, I need to get this file and send it to a specific directory on AS400 server.

Regards,

mgg

0 Kudos

Ok, again, if you are referring to the IFS on AS400, then this is like any other directory on your network, but it must be shared out. You iSeries(as/400) admin should be able to help with this. So if the file is on the SAP application server, you need to read it into an internal table and then download it to the other directory.

Just tested this. It is pulling a text file from my application server and putting it on another AS400 in my landscape. This is working for a regular .txt file, I couldn't get it working using a .bmp file. Something wrong with the binary.




report zrich_0002.


data: begin of itab occurs 0,
      field(256) type c,
      end   of itab.


data: source(100) value '/usr/sap/TST/sys/test.txt',
      target(100) value '\sapprdqdlsalhtest.txt',
      file type string,
      length  type i,
      lines type i.

clear itab. refresh itab.
open dataset  source for input in text mode.
do.
  read dataset  source into itab-field.
  if sy-subrc = 0.
    append itab.
  else.
    exit.
  endif.
enddo.

*describe table itab lines lines.
*length =  lines * 256.

file = target.
call function 'GUI_DOWNLOAD'
     exporting
          filename     = file
*          filetype     = 'BIN'
*          bin_filesize = length
     tables
          data_tab     = itab.

Regards,

RIch Heilman

0 Kudos

Thanks, again

I'm going to check my code lines and modify some lines as you suggested, I will let you know how helpfull was your advice

Regards,

mgg

Former Member
0 Kudos

Thanks Rich, your code lines were very very helpfull.

Regards

mgg