메뉴 건너뛰기

SAP 한국 커뮤니티

FTP 호출 프로그램 예제

sapjoy 2014.11.28 09:43 조회 수 : 5638

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