메뉴 건너뛰기

SAP 한국 커뮤니티

FTP 호출 프로그램 예제

sapjoy 2014.11.28 09:43 조회 수 : 5641

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.
번호 제목 글쓴이 날짜 조회 수
487 ALV 동적 필드 구성 [4] 꿀홍삼 2015.02.06 9550
486 SUBQUERY 사용예 입니다. [1] 노름마치 2007.11.20 9539
485 Open SQL에서 SUM 사용시 유의사항. [11] 나침반친구 2007.06.07 9539
484 간단한 계산공식은 Macro를 사용하자 [5] 양키 2011.04.14 9532
483 Field Catalog 가져오지 못하는문제(REUSE_ALV_FIELDCATALOG_MERGE) [3] 양키 2013.08.16 9485
482 sap 메뉴에서 표준 매뉴 전환 [1] selection장 2013.09.13 9445
481 FIELD-SYMBOL설명 및 예제 프로그램 [17] Delight 2008.04.30 9426
480 <img src=d.gif>Source Activation 시 [READ_REPORT_LINE_TOO_LONG] dump 발생하면?[추천:e-abap] [5] JYG 2011.02.11 9417
479 테이블컨트롤에서 F4 값 변경시 다른 필드 값도 변경하기 F4IF_INT_TABLE_VALUE_REQUEST [1] 한해동안 2008.07.24 9406
478 표준편차구하는 로직 윤사모 2011.03.23 9369
477 BAPI_MATERIAL_SAVEDATA 자재마스터 생성시에 사용하세요. [1] 노름마치 2007.12.10 9240
476 SAP 단순하지만, 모르면 정말 불편 한 기능들 [22] SARA 2007.03.27 9217
475 TYPE-1 프로그램에서 실행버튼 없애기 [1] 아밥뽀 2013.09.23 9109
474 엑셀에서 '-' 부호 앞으로 옮기기 [18] file MasFI 2013.02.08 8990
473 SELECT-OPTIONS 문법 [5] sapjoy 2006.12.28 8978
472 ALV 내용 변경 방법. [8] 초보보초보 2007.02.07 8928
471 SAP GUI 730 ALV Grid 느림 현상(해결방법) [3] Dave 2013.09.27 8883
470 효과적인 ABAP/4 프로그램 작성기법 [24] 열공아밥 2009.12.20 8878
469 유용한 t-code 모음들 [26] 아이디빵 2008.04.24 8795
468 where 조건을 상황에따라 바꿔볼까? [8] 양키 2011.04.14 8738