메뉴 건너뛰기

SAP 한국 커뮤니티

FTP 호출 프로그램 예제

sapjoy 2014.11.28 09:43 조회 수 : 5659

report rsftp002.

parametersuser(30type lower case,
            pwd(30type lower case,
            host(64type lower case,
            cmd1(80type lower case,
            cmd2(80type lower case,
            cmd3(80type lower case,
            dest like rfcdes-rfcdest default 'SAPFTP',
            compress type default 'N'.

datahdl type i,
      key type value 26101957,
      slen type i.

databegin of result occurs 0,
      line(100type c,
      end of result.

set extended check off.
slen strlenpwd ).

AUTHORITY-CHECK OBJECT 'S_ADMI_FCD'
         ID 'S_ADMI_FCD'
         FIELD 'SFTP'.
IF sy-subrc <> 0.
  MESSAGE 'no_authorization' type 'E'.
  exit.
*     Keine Berechtigung zum Ändern der Aktivierung einer ID
ENDIF.

CALL FUNCTION 'HTTP_SCRAMBLE'
  exporting
    source      pwd
    sourcelen   slen
    key         key
  importing
    destination pwd.

call function 'FTP_CONNECT'
  exporting
    user            user
    password        pwd
    host            host
    rfc_destination dest
  importing
    handle          hdl.

if cmd1 ne ' '.
  call function 'FTP_COMMAND'
    exporting
      handle        hdl
      command       cmd1
      compress      compress
    tables
      data          result
    exceptions
      command_error 1
      tcpip_error   2.
  loop at result.
    write at / result-line.
  endloop.
  refresh result.
endif.

if cmd2 ne ' '.
  call function 'FTP_COMMAND'
    exporting
      handle        hdl
      command       cmd2
    tables
      data          result
    exceptions
      command_error 1
      tcpip_error   2.
  loop at result.
    write at / result-line.
  endloop.
  refresh result.
endif.

if cmd3 ne ' '.
  call function 'FTP_COMMAND'
    exporting
      handle        hdl
      command       cmd3
    tables
      data          result
    exceptions
      command_error 1
      tcpip_error   2.
  loop at result.
    write at / result-line.
  endloop.
  refresh result.
endif.

call function 'FTP_DISCONNECT'
  exporting
    handle hdl.

call function 'RFC_CONNECTION_CLOSE'
  exporting
    destination dest
  exceptions
    others 1.

* password not visible

at selection-screen output.

  loop at screen.
    if screen-name 'PWD'.
      screen-invisible '1'.
      modify screen.
    endif.
  endloop.
번호 제목 글쓴이 날짜 조회 수
327 유용한 t-code 모음들 [26] 아이디빵 2008.04.24 8808
326 SAP의 On-line Program에서 Double Click Event 잡는 법 [8] Delight 2008.04.30 6464
325 FIELD-SYMBOL설명 및 예제 프로그램 [17] Delight 2008.04.30 9461
324 CTS Rollback [5] 심마니 2008.05.23 5944
323 Internal Table 내용 PC에 저장하기 [11] 별이고픈구름 2008.05.28 3828
322 강제 Search Help 코딩과 선택시 해당 Description 채우기 [11] file 별이고픈구름 2008.05.29 4389
321 서버 리스트 한번에 올리기... [8] bizarre 2008.06.02 4022
320 tables // data ~ like 로 선언한 WA 변수의 차이점 [3] bizarre 2008.06.03 3965
319 System field 정리 [5] magicsy69 2008.06.03 9801
318 SAP 기본폼과 순서는 다음과 같이...이쁘게 [7] magicsy69 2008.06.03 4732
317 나름데로 User Exit 정리 [17] 한해동안 2008.06.03 11104
316 BSP 명령구절 [3] gauguin 2008.06.04 3837
315 MiniSAP SAP Netweaver 7.0 ABAP Trial Version의 인스톨 [8] gauguin 2008.06.08 7171
314 OPEN SQL 사용법인데, 내용이 정리가 잘 되어 있네요 [21] file 노름마치 2008.06.09 3712
313 ALV 엑셀 다운로드시 한글깨짐 해결 [7] sapjoy 2008.06.12 11057
312 saplogon 할때 갑자기 윈도우 services화일 못찾을떄 요섭아부지 2008.06.12 4146
311 workflow 와 wepflow를 위한 초보 가이드 [2] file gauguin 2008.06.14 2967
310 ABAP에서다른DB가져오기(DB-Link처리) [4] Delight 2008.06.16 8731
309 토드 사용법 [15] file 대전희망 2008.06.20 6185
308 Oracle Performance Tunning [1] file 대전희망 2008.06.20 2789