메뉴 건너뛰기

SAP 한국 커뮤니티

FTP 호출 프로그램 예제

sapjoy 2014.11.28 09:43 조회 수 : 5662

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 Open SQL에서 SUM 사용시 유의사항. [11] 나침반친구 2007.06.07 9611
486 ALV 동적 필드 구성 [4] 꿀홍삼 2015.02.06 9594
485 윈도우7에서 sapgui가 꺼지는 현상에 관한 팁 [14] 고양이야옹 2010.10.21 9575
484 Field Catalog 가져오지 못하는문제(REUSE_ALV_FIELDCATALOG_MERGE) [3] 양키 2013.08.16 9560
483 간단한 계산공식은 Macro를 사용하자 [5] 양키 2011.04.14 9543
482 FIELD-SYMBOL설명 및 예제 프로그램 [17] Delight 2008.04.30 9463
481 sap 메뉴에서 표준 매뉴 전환 [1] selection장 2013.09.13 9449
480 테이블컨트롤에서 F4 값 변경시 다른 필드 값도 변경하기 F4IF_INT_TABLE_VALUE_REQUEST [1] 한해동안 2008.07.24 9432
479 <img src=d.gif>Source Activation 시 [READ_REPORT_LINE_TOO_LONG] dump 발생하면?[추천:e-abap] [5] JYG 2011.02.11 9426
478 표준편차구하는 로직 윤사모 2011.03.23 9371
477 BAPI_MATERIAL_SAVEDATA 자재마스터 생성시에 사용하세요. [1] 노름마치 2007.12.10 9271
476 SAP 단순하지만, 모르면 정말 불편 한 기능들 [22] SARA 2007.03.27 9239
475 TYPE-1 프로그램에서 실행버튼 없애기 [1] 아밥뽀 2013.09.23 9122
474 엑셀에서 '-' 부호 앞으로 옮기기 [18] file MasFI 2013.02.08 9016
473 SELECT-OPTIONS 문법 [5] sapjoy 2006.12.28 8992
472 ALV 내용 변경 방법. [8] 초보보초보 2007.02.07 8937
471 SAP GUI 730 ALV Grid 느림 현상(해결방법) [3] Dave 2013.09.27 8885
470 효과적인 ABAP/4 프로그램 작성기법 [24] 열공아밥 2009.12.20 8885
469 Report 개발 시 Select-option에 search help 값이 자동으로 입력이 안될때 [6] file 곰님MAX 2010.02.12 8836
468 유용한 t-code 모음들 [26] 아이디빵 2008.04.24 8816