메뉴 건너뛰기

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.
번호 제목 글쓴이 날짜 조회 수
488 BAPI_PO_CREATE1 구매오더 생성시에 사용하세요 [8] 노름마치 2007.12.11 9877
487 유용한 SAP System T-CODE sapjoy 2014.05.16 9863
486 LOOP 필드심볼이 빠르다.FIELD-SYMBOL [8] file sapjoy 2012.03.12 9778
485 PD 인포타입 [3] file 준서기 2012.04.01 9726
484 BAPI_MATERIAL_SAVEDATA 자재마스터 생성시에 사용하세요. [1] 노름마치 2007.12.11 9719
483 윈도우7에서 sapgui가 꺼지는 현상에 관한 팁 [14] 고양이야옹 2010.10.22 9666
482 간단한 계산공식은 Macro를 사용하자 [5] 양키 2011.04.14 9649
481 FIELD-SYMBOL설명 및 예제 프로그램 [17] Delight 2008.04.30 9604
480 테이블컨트롤에서 F4 값 변경시 다른 필드 값도 변경하기 F4IF_INT_TABLE_VALUE_REQUEST [1] 한해동안 2008.07.25 9575
479 sap 메뉴에서 표준 매뉴 전환 [1] selection장 2013.09.13 9529
478 <img src=d.gif>Source Activation 시 [READ_REPORT_LINE_TOO_LONG] dump 발생하면?[추천:e-abap] [5] JYG 2011.02.11 9511
477 표준편차구하는 로직 윤사모 2011.03.24 9490
476 Area menu 한방에 다운로드 >,.< [10] 배불뚝이용 2013.02.27 9472
475 SAP 단순하지만, 모르면 정말 불편 한 기능들 [22] SARA 2007.03.28 9429
474 TYPE-1 프로그램에서 실행버튼 없애기 [1] 아밥뽀 2013.09.24 9284
473 엑셀에서 '-' 부호 앞으로 옮기기 [18] file MasFI 2013.02.08 9219
472 SELECT-OPTIONS 문법 [5] sapjoy 2006.12.29 9116
471 SAP 모니터링 T-CODE [11] 아밥뽀 2014.07.08 9106
470 SAP GUI 730 ALV Grid 느림 현상(해결방법) [3] Dave 2013.09.27 9101
469 ALV 내용 변경 방법. [8] 초보보초보 2007.02.07 9051