ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 向FTP Server放 text file (1)

向FTP Server放 text file (1)

原创 Linux操作系统 作者:ytfsrs2008 时间:2009-02-12 10:40:41 0 删除 编辑

tables: mara,marc.

data: begin of itab occurs 0,

        werks like marc-werks,

        matnr like mara-matnr,

      end of itab.

data : hdl type i,

       key type i value 26101957,

       dstlen type i,

       subrc like sy-subrc value 0.

data : fold(50) type c.

 

data: begin of commands occurs 0,

        cmd(100) type c,

      end of commands.

 

data: begin of result occurs 0,

        line(100) type c,

      end of result.

 

 start-of-selection.

      itab-werks = 'PWAC'.

      itab-matnr = '4G001-001'.

      append itab.

      clear itab.

 

       itab-werks = 'PWAC'.

      itab-matnr = '4G001-002'.

      append itab.

      clear itab.

       itab-werks = 'PWAC'.

      itab-matnr = '4G001-003'.

      append itab.

      clear itab.

   perform. conn_ftp.

   perform. send_data_form.

*&----------------------------------------------------------------*

*&      Form  CONN_FTP

*&----------------------------------------------------------------*

   form. conn_ftp.

  data: pwd(20) type c ,

        host(255) type c,

        login(20) type c.

   login = 'apdit'.

   pwd = 'apdit$110$'.

   host = '10.194.4.253 2120'.   “FTP server地址和端口2120

  translate pwd to lower case.

  translate login to lower case.

 

  call 'AB_RFC_X_SCRAMBLE_STRING'

    id 'SOURCE'      field pwd    id 'KEY'         field key

    id 'SCR'         field 'X'    id 'DESTINATION' field pwd

    id 'DSTLEN'      field dstlen.

 

  call function 'FTP_CONNECT'  “连接FTP Server

    exporting

      user            = login

      password        = pwd

      host            = host

      rfc_destination = 'SAPFTPA'

    importing

      handle          = hdl

    EXCEPTIONS

      NOT_CONNECTED          = 1

      OTHERS                 = 2 .

  IF SY-SUBRC NE 0.

    HDL = -1.

    EXIT.

  ENDIF.

  clear commands.

  refresh commands.

  concatenate 'cd' '/' into commands-cmd separated by space.

 “ cd /表示进入当前目录

  append commands.

  commands-cmd = 'ascii'.

  append commands.

  perform. ftpc.

endform.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15117617/viewspace-548791/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-10-31

  • 博文量
    52
  • 访问量
    51719