메뉴 건너뛰기

SAP 한국 커뮤니티

FTP 호출 프로그램 예제

sapjoy 2014.11.28 18:43 조회 수 : 5955

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.
번호 제목 글쓴이 날짜 조회 수
548 ABAP TUNNING sapjoy 2012.03.13 234870
547 New function vs Old function(obsolete) sapjoy 2014.03.31 130235
546 테이블Active시 (Warnings Occurred During Activation) 안나오게하는방법 [6] 양키 2012.03.29 99872
545 자주 사용하는 String 조작 명령어 [7] 양키(이경환) 2015.01.13 36502
544 사용자 패스워드 변경 함수, 창 [11] sapjoy 2009.12.21 28577
543 collect 구문 [4] sapjoy 2006.12.03 27363
542 R/3 용어 정의 Definitions [4] sapjoy 2007.01.23 24007
541 BAPI_PR_CREATE 구매요청 생성시에 사용하세요 [2] 노름마치 2007.12.11 23872
540 SELECT statement D.Y.Kim 2007.07.20 23716
539 ABAP 구문 총정리 [39] file Wise 멘토 2008.11.25 23453
538 문자열에 있는 값이 숫자만으로 되어있는지 문자가 포함됐는지 체크하는 함수 [3] 꿀단지 2011.10.11 20647
537 숫자입력 체크(Numeric character check) [1] 양키(이경환) 2014.01.28 20491
536 LIKE와 TYPE의 차이 [13] sapjoy 2006.12.06 20012
535 SDN -> SCN 변경되면서 Contents별로 바뀐 LINK 모음 [13] Wise 멘토 2012.07.06 19686
534 프로그램 정보(프로그램 리스트, PROGRAM LIST, PROGRAM TABLE) [3] sapjoy 2007.02.24 18608
533 인터널 테이블 라인수 lines [8] sapjoy 2014.01.20 17819
532 ALV LIST 진행시 LAYOUT 속성값 [18] kwon09 2007.04.11 17629
531 SYST 시스템 변수 정리 [5] 아밥뽀 2014.08.23 17562
530 ABAP 핵심정리 [23] SARA 2007.03.15 17472
529 FOR ALL ENTRIES IN 구문 사용시 select 필드 선택시 주의사항. [7] 나침반친구 2007.03.13 17416