Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7185002
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2007-07-21 08:50:47

*&---------------------------------------------------------------------*
*& Report  Z_BARRY_FTP_MAINTAIN                                        *
*&                                                                     *
*&---------------------------------------------------------------------*
*&   用简单的方式维护单条记录的数据                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
REPORT z_scm_ftp_maintain .
TABLES: zscm_ftp, sscrfields.
DATA: ans TYPE c,
      suc TYPE c.
PARAMETERS: p_host(20) TYPE c OBLIGATORY ,
            p_user(20) TYPE c OBLIGATORY LOWER CASE,
            p_pass(20) TYPE c OBLIGATORY LOWER CASE.
SELECTION-SCREEN FUNCTION KEY 1.
INITIALIZATION.
  sscrfields-functxt_01 = text-001 .
  SELECT SINGLE * FROM zscm_ftp .
  IF sy-subrc = 0.
    p_host = zscm_ftp-host.
    p_user = zscm_ftp-usr .
    p_pass = zscm_ftp-pwd .
  ENDIF.
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CASE screen-name.
      WHEN 'P_PASS'.
        screen-invisible  = 1.
    ENDCASE.
    MODIFY SCREEN.
  ENDLOOP.
AT SELECTION-SCREEN.
  IF sy-ucomm = 'FC01'.
    PERFORM connect_check.
  ELSEIF sy-ucomm = 'ONLI'.
    IF suc <> 'X'.
      MESSAGE e000(z900) WITH '请先测试连接通过'.
    ENDIF.
  ENDIF.
START-OF-SELECTION.
  CALL FUNCTION 'POPUP_TO_CONFIRM'
       EXPORTING
            titlebar      = '确认更新'
            text_question = '确认更新FTP数据?'
       IMPORTING
            answer        = ans.                            "1、 2、 A
  IF ans <> '1'  .
    LEAVE PROGRAM .
  ENDIF .
  zscm_ftp-host = p_host.
  zscm_ftp-usr  = p_user.
  zscm_ftp-pwd  = p_pass.
  MODIFY zscm_ftp .
  IF sy-subrc = 0.
    WRITE 'Success!'.
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  connect_check
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM connect_check.
  DATA: mi_key TYPE i VALUE 26101957,
        mi_handle TYPE i,
        slen TYPE i .
  DATA: ftp_pass(30) TYPE c.
  ftp_pass = p_pass.
  slen = strlen( ftp_pass ).
  CLEAR suc.
  CALL 'AB_RFC_X_SCRAMBLE_STRING'
    ID 'SOURCE'      FIELD ftp_pass
    ID 'KEY'         FIELD mi_key
    ID 'SCR'         FIELD 'X'
    ID 'DESTINATION' FIELD ftp_pass
    ID 'DSTLEN'      FIELD slen.
  CALL FUNCTION 'FTP_CONNECT'
       EXPORTING
            user            = p_user
            password        = ftp_pass
            host            = p_host
            rfc_destination = 'SAPFTPSCM'
       IMPORTING
            handle          = mi_handle
       EXCEPTIONS
            not_connected   = 1
            OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  MESSAGE i000(z900) WITH '测试成功,可以F8保存新的FTP信息'.
  suc = 'X'.
  CALL FUNCTION 'FTP_DISCONNECT'
       EXPORTING
            handle = mi_handle
       EXCEPTIONS
            OTHERS = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " connect_check
阅读(3831) | 评论(0) | 转发(0) |
0

上一篇:SYS INFO

下一篇:关于ALV GRID的颜色

给主人留下些什么吧!~~