cancel
Showing results for 
Search instead for 
Did you mean: 

Why 'ftp_r3_to_server' function send just 4 records ?

Former Member
0 Kudos

Hello Everybody,

You can see at above,

When i try to send more than 4 records with 'ftp_r3_to_server' function, i receive an error code : Sy-subrc = 3.

But there is no problem to send less and equal 4 records.

Do you have any idea about this situation ?

FORM send_file_ftp .

   break absmaraba.

   DATA: user(30) TYPE c   VALUE 'ftp_user',

         pwd(30) TYPE  c   VALUE 'f!ikinci81',

         host(64) TYPE c   VALUE '172.17.1.209',

         cmd1(80) TYPE c,

         cmd2(80) TYPE c,

         cmd3(80) TYPE c,

         dest LIKE rfcdes-rfcdest VALUE 'SAPFTP' , "'SAPFTP',

         docid LIKE sysuuid-c,

         compress TYPE c VALUE 'N',

         command(120) TYPE c,

         lv_target TYPE char40.

   DATA: hdl TYPE i,

         key TYPE i VALUE 26101957,

         slen TYPE i.

   DATA: BEGIN OF result OCCURS 0,

     line(100) TYPE c,

   END OF result.

   SET EXTENDED CHECK OFF.

   slen = strlen( pwd ).

   CALL FUNCTION 'HTTP_SCRAMBLE'

     EXPORTING

       source      = pwd

       sourcelen   = slen

       key         = key

     IMPORTING

       destination = pwd.

   CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

     EXPORTING

       text = 'Connect to FTP Server'.

   CALL FUNCTION 'FTP_CONNECT'

     EXPORTING

       user            = user

       password        = pwd

       host            = host

       rfc_destination = dest

     IMPORTING

       handle          = hdl

     EXCEPTIONS

       not_connected.

   IF sy-subrc <> 0.

     MESSAGE 'FTP ''ye bağlanılamadı !!!' TYPE 'I' DISPLAY LIKE 'E'.

   ELSE.

*Path: /var/www/xml/AcikArtirma.xml

     command = 'cd /var/www/xml/'. "xml klasörünü açalım!

     CALL FUNCTION 'FTP_COMMAND' "Klasore Git

     EXPORTING

       handle        = hdl

       command       = command "'cd Arsiv' "talimat klasoru

       compress      = compress

     TABLES

     data          = result

     EXCEPTIONS

       command_error = 1

       tcpip_error   = 2.

     IF sy-subrc  IS NOT INITIAL.

       CALL FUNCTION 'FTP_DISCONNECT'

         EXPORTING

           handle = hdl.

       CALL FUNCTION 'RFC_CONNECTION_CLOSE'

         EXPORTING

           destination          = 'SAPFTP'

*         TASKNAME             =

         EXCEPTIONS

           destination_not_open = 1

           OTHERS               = 2.

     ELSE.

       CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

         EXPORTING

           text = 'Create file on FTP Server'.

       DATA: wrk_file TYPE char200.

       DATA: lv_blob_length TYPE i.

       lv_blob_length = '16384'.

       CONCATENATE "'\xml\'

*  sy-datum

*  sy-uzeit

       'AcikArtirma'

       '.xml'

       INTO wrk_file.

BREAK avolkand.

       IF sy-sysid EQ 'CDD'.

         CALL FUNCTION 'FTP_R3_TO_SERVER'   "'FTP_R3_TO_SERVER'

           EXPORTING

             handle         = hdl

             fname          = wrk_file "file path of destination system

*           blob_length    = lv_blob_length

             character_mode = 'X'

           TABLES

*           blob           = itab

             text           = itab

           EXCEPTIONS

             tcpip_error    = 1

             command_error  = 2

             data_error     = 3

             OTHERS         = 4.

         IF sy-subrc IS NOT INITIAL.

          MESSAGE 'Dosya , FTP''ye Gönderilemedi , tekrar deneyiniz !!!'

          TYPE 'I'

          DISPLAY LIKE 'E'.

         ELSE.

          MESSAGE 'Dosya ,FTP''ye Gönderildi ' TYPE 'I' DISPLAY LIKE 'S'.

         ENDIF.

       ENDIF.

* Dosya taşıma işlemi bitti

       CALL FUNCTION 'FTP_DISCONNECT'

         EXPORTING

           handle = hdl.

       CALL FUNCTION 'RFC_CONNECTION_CLOSE'

         EXPORTING

           destination          = 'SAPFTP'

*         TASKNAME             =

         EXCEPTIONS

           destination_not_open = 1

           OTHERS               = 2.

     ENDIF.

   ENDIF.

ENDFORM.                    " SEND_FILE_FTP

Thank you

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Which type of destination are you using?

SAPFTP runs for the client(PC) and SAPFTPA runs on the application server.

So when connecting from your SAP AS to another remote host, then you use SAPFTPA.

And when connecting from your client(PC) to other remote host, use SAPFTP.

Thanks

Ben

Former Member
0 Kudos

Hi Benson,

I tried boh of them sapftpa and sapftp, but not changed this situation