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

Sending the content of an internal table directly to FTP Server.

SantiMoreno
Participant
0 Kudos
1,460

Hi ABAPERs.

I've been searching any information about how to send a content, stored in an internal table of an ABAP program, to a FTP server., but I haven't been able to find such info.

Is it there any FM to do such work or I should download it to application server (or presentation server, better in app server 'cause process is in background)? The problem is that we're having a lot of problems in the dataset downloading.

Thanks a lot.

1 ACCEPTED SOLUTION
Read only

SantiMoreno
Participant
913

I think I haven't explained correctly (sorry for my English).

The problem is that NOW we are downloading (transferring dataset) to the Application Server and we're having some problems with both code-page transformations and line-feed management.

So, what we want to avoid is transferring dataset to app server and send the content of the internal table to FTP directly.

Thanks.

6 REPLIES 6
Read only

Former Member
0 Kudos
913

Hi,

use open dataset , transfer dataset commands to transfer to application server

Thanks & regards

Read only

Former Member
0 Kudos
913

Hi,

After HTTP_SCRAMBLE and FTP_CONNECT functions. Use these functions one by one .


    CALL FUNCTION 'FTP_COMMAND'
      EXPORTING
        handle        = mi_handle
        command       = 'ascii'
      TABLES
        data          = mtab_data   "internal table
      EXCEPTIONS
        tcpip_error   = 1
        command_error = 2
        data_error    = 3
        OTHERS        = 4.

then set folder path


      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = mi_handle
          command       = 'cd /company/'   "command contains a space 
        TABLES
          data          = mtab_data
        EXCEPTIONS
          tcpip_error   = 1
          command_error = 2
          data_error    = 3
          OTHERS        = 4.

set a filename and call put command.


filename LIKE rlgrap-filename.

        CONCATENATE
       'TCK71' "pattern
          sy-datum
          '.txt' INTO filename

CONCATENATE 'put' filename INTO command SEPARATED BY space.
"then call  
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = mi_handle
          command       = command
        TABLES
          data          = mtab_data
        EXCEPTIONS
          tcpip_error   = 1
          command_error = 2
          data_error    = 3
          OTHERS        = 4.

don t forget close connection. use FTP_DISCONNECT

Take care.

Çağatay

Read only

SantiMoreno
Participant
914

I think I haven't explained correctly (sorry for my English).

The problem is that NOW we are downloading (transferring dataset) to the Application Server and we're having some problems with both code-page transformations and line-feed management.

So, what we want to avoid is transferring dataset to app server and send the content of the internal table to FTP directly.

Thanks.

Read only

0 Kudos
913

Check standard programs RSFTP007 and RSFTP004.

Or this link:

http://wiki.sdn.sap.com/wiki/display/ABAP/FTPfiletransferinBackground

Read only

0 Kudos
913

Thanks, Roy.

Seems to be a very helpful answer... I was told that such FM was not for such action.

Anyway, if it finally works, I'll give you the full reward.

Kind Regards.

Read only

Ajain
Explorer
0 Kudos
838

Hello,
Do we have a solution here.

As I am not able to send internal table data to FTP folder in background mode.
Foreground is working fine, File is created in FTP folder.