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

Table data send to FTP location

Former Member
0 Likes
680
CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      USER            = WA_ZFTPPASSWORDS-FTPUSERID
      PASSWORD        = WA_ZFTPPASSWORDS-FTPPASSWORD
      HOST            = WA_ZFTPPASSWORDS-FTPURL
      RFC_DESTINATION = C_RFCDEST
    IMPORTING
      HANDLE          = L_HANDLE
    EXCEPTIONS
      NOT_CONNECTED   = 1
      OTHERS          = 2.
  IF SY-SUBRC <> 0.
    CASE SY-SUBRC.
      WHEN 1.
        MESSAGE I000 WITH TEXT-027.                         "#EC *
      WHEN 2.
        MESSAGE I000 WITH TEXT-028.
    ENDCASE.
    SUBRC = SY-SUBRC.
    EXIT.
  ENDIF.


  CONCATENATE 'cd' 'IN' INTO L_COMMAND SEPARATED BY SPACE.
  CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
      HANDLE        = L_HANDLE
      COMMAND       = L_COMMAND
    TABLES
      DATA          = LT_RESULT
    EXCEPTIONS
      TCPIP_ERROR   = 1
      COMMAND_ERROR = 2
      DATA_ERROR    = 3
      OTHERS        = 4.
  IF SY-SUBRC <> 0.
    PERFORM ERROR_MESSAGE.
    SUBRC = SY-SUBRC.
    EXIT.
  ENDIF.

CALL FUNCTION 'FTP_R3_TO_SERVER'
          EXPORTING
            HANDLE         = L_HANDLE
            FNAME          = L_FNAME
            CHARACTER_MODE = C_VAR
          TABLES
            TEXT           = LT_STRING
          EXCEPTIONS
            TCPIP_ERROR    = 1
            COMMAND_ERROR  = 2
            DATA_ERROR     = 3
            OTHERS         = 4.
        IF SY-SUBRC <> 0.
          PERFORM ERROR_MESSAGE.
          SUBRC = SY-SUBRC.
          EXIT.
        ENDIF.

In the above code LT_STRING having charecter formated data.

we are sending to FTP location .The file name was moved to FTP but no data in that file .

please help on this .I tried all the documents in SDN.

Edited by: subrahmanyam24 on Dec 23, 2010 3:50 PM

Edited by: subrahmanyam24 on Dec 23, 2010 3:56 PM

CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      USER            = WA_ZFTPPASSWORDS-FTPUSERID
      PASSWORD        = WA_ZFTPPASSWORDS-FTPPASSWORD
      HOST            = WA_ZFTPPASSWORDS-FTPURL
      RFC_DESTINATION = C_RFCDEST
    IMPORTING
      HANDLE          = L_HANDLE
    EXCEPTIONS
      NOT_CONNECTED   = 1
      OTHERS          = 2.
  IF SY-SUBRC <> 0.
    CASE SY-SUBRC.
      WHEN 1.
        MESSAGE I000 WITH TEXT-027.                         "#EC *
      WHEN 2.
        MESSAGE I000 WITH TEXT-028.
    ENDCASE.
    SUBRC = SY-SUBRC.
    EXIT.
  ENDIF.


  CONCATENATE 'cd' 'IN' INTO L_COMMAND SEPARATED BY SPACE.
  CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
      HANDLE        = L_HANDLE
      COMMAND       = L_COMMAND
    TABLES
      DATA          = LT_RESULT
    EXCEPTIONS
      TCPIP_ERROR   = 1
      COMMAND_ERROR = 2
      DATA_ERROR    = 3
      OTHERS        = 4.
  IF SY-SUBRC <> 0.
    PERFORM ERROR_MESSAGE.
    SUBRC = SY-SUBRC.
    EXIT.
  ENDIF.

CALL FUNCTION 'FTP_R3_TO_SERVER'
          EXPORTING
            HANDLE         = L_HANDLE
            FNAME          = L_FNAME
            CHARACTER_MODE = C_VAR
          TABLES
            TEXT           = LT_STRING
          EXCEPTIONS
            TCPIP_ERROR    = 1
            COMMAND_ERROR  = 2
            DATA_ERROR     = 3
            OTHERS         = 4.
        IF SY-SUBRC <> 0.
          PERFORM ERROR_MESSAGE.
          SUBRC = SY-SUBRC.
          EXIT.
        ENDIF.

In the above code LT_STRING having charecter formated data.

we are sending to FTP location .The file name was moved to FTP but no data in that file .

please help on this .I tried all the documents in SDN.

Edited by: subrahmanyam24 on Dec 23, 2010 3:50 PM

Edited by: subrahmanyam24 on Dec 23, 2010 3:56 PM

3 REPLIES 3
Read only

Former Member
0 Likes
634

Hi,

Check if LT_STRING is declared as an internal table ..

for ex:

data: begin of LT_STRING occurs 0,

text(250),

end of LT_STRING.

Regards,

Srini.

Read only

Former Member
0 Likes
634

Thanks

Read only

Clemenss
Active Contributor
0 Likes
634

Hi subrahmanyam24,

what is the definition of LT_STRING. If it is a table of ABAP data type string, this may not work because ABAP strings are not compatible to text file records.

You should use a table of recors which arte long enough, i.e. text1000 or so.

Regards,

Clemens