메뉴 건너뛰기

SAP 한국 커뮤니티

FTP 호출 프로그램 예제

sapjoy 2014.11.28 09:43 조회 수 : 5645

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 Effective_Code_Writing [3] file sapjoy 2007.04.18 2991
486 sap perforamnce check t-code list [2] sapjoy 2014.06.16 3042
485 Creating Custom Screen in XD01 [2] file 노름마치 2009.07.10 3055
484 Working with Substitution Exit [6] file 노름마치 2009.07.10 3064
483 Implementing Field Exit for the transaction MK01 [3] file 노름마치 2009.07.10 3150
482 Working with User-Exits for the transaction VA01 [3] file 노름마치 2009.07.10 3169
481 User Parameter 조회 펑션 [3] 양키(이경환) 2014.03.04 3176
480 Do and Dont's in ABAP Programming [5] file sapjoy 2007.04.18 3182
479 Creating Change Documents for Custom tables (Step-by-step procedure) Using SCDO [2] file 노름마치 2009.07.10 3194
478 jco_tutorial-ja_doo [2] file kk 2008.01.23 3197
477 Adding Custom Fields using EEWB Transaction [1] file 노름마치 2009.07.10 3217
476 BTE_Scenario on Business Transaction Events [7] file 노름마치 2009.07.10 3272
475 대용량 DATA 병렬 처리 샘플 프로그램 - Parallel Process [2] file moonical 2021.09.09 3285
474 Restrict users (sales persons) to view or change Sales order data - Using Enhancement framework [3] file 노름마치 2009.07.10 3297
473 BDC 수행시 COMMAND 명령어 sapjoy 2014.09.18 3300
472 SAP tips Journal - 6,7월 호 (2008) [9] file onefineday 2009.02.11 3303
471 Setting the screen elements as mandatory in the transaction DP95 using Enhancement Framework [2] file 노름마치 2009.07.10 3314
470 ALV TOOLBAR 메뉴 버튼을 올립니다. [6] file 블루보이 2013.06.26 3321
469 드롭다운 리스트 key값 조회하기 [4] file 아밥뽀 2014.09.21 3341
468 앞의 0으로 시작하는 문자 모두 지우기 sapjoy 2014.08.20 3349