Chinaunix首页 | 论坛 | 博客
  • 博客访问: 149946
  • 博文数量: 54
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 508
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-18 09:25
个人简介

好男人就是我,我就是你兵哥

文章分类

全部博文(54)

我的朋友

分类: Web开发

2014-09-19 17:17:56

原文地址:求加解密函數 作者:sanly

REPORT           zrab_zyb_test.

PARAMETERS:  p_pswd(32) TYPE c DEFAULT 'Welcome 007'.

AT SELECTION-SCREEN OUTPUT.
  PERFORM modify_screen.

START-OF-SELECTION.
  CONDENSE p_pswd.
  WRITE: / 'Source password:', p_pswd.
  CALL FUNCTION 'FIEB_PASSWORD_ENCRYPT'
       EXPORTING
            im_decrypted_password = p_pswd
       IMPORTING
            ex_encrypted_password = p_pswd.
  CONDENSE p_pswd.
  WRITE: / 'Encrypted String:', p_pswd.


  SKIP 2.

  WRITE: / 'Encrypted String:', p_pswd.
  CALL FUNCTION 'FIEB_PASSWORD_DECRYPT'
       EXPORTING
            im_encrypted_password = p_pswd
       IMPORTING
            ex_decrypted_password = p_pswd.
  CONDENSE p_pswd.
  WRITE: / 'Source password:', p_pswd.
*&---------------------------------------------------------------------*
*&      Form  modify_screen
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM modify_screen.
  LOOP AT SCREEN.
    IF screen-name = 'P_PSWD'.
      screen-invisible = 1.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " modify_screen



而在ABAP 6下可以這麼用:


DATA:   lo_encryptor TYPE REF TO cl_hard_wired_encryptor,   lo_cx_error  TYPE REF TO cx_encrypt_error,   lv_ac_string TYPE string VALUE 'Welcome to ABAP',   lv_en_string TYPE string,   lv_de_string TYPE string,   lv_error_msg TYPE string. PARAMETERS:  p_string TYPE string DEFAULT 'Welcome to ABAP'. START-OF-SELECTION.   CLEARlv_ac_string,lv_en_string,lv_de_string,lv_error_msg .   CREATE OBJECT lo_encryptor.   TRY.       CALL METHOD lo_encryptor->encrypt_string2string
        EXPORTING           the_string p_string
        RECEIVING
          result     lv_en_string.     CATCH cx_encrypt_error INTO lo_cx_error.       CALL METHOD lo_cx_error->if_message~get_text
        RECEIVING
          result lv_error_msg.   ENDTRY.   WRITE:'Actual String: 'p_string.   WRITE:'Encrypted String: 'lv_en_string.   SKIP.   TRY.       CALL METHOD lo_encryptor->decrypt_string2string
        EXPORTING           the_string lv_en_string
        RECEIVING
          result     lv_de_string.     CATCH cx_encrypt_error INTO lo_cx_error.       CALL METHOD lo_cx_error->if_message~get_text
        RECEIVING
          result lv_error_msg.   ENDTRY.   WRITE:'Encrypted String: 'lv_en_string.   WRITE:'Decrypted String: 'lv_de_string. 
阅读(582) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~