熬死你的 发表于 2019-2-2 11:18:00

SAP学习笔记

*&---------------------------------------------------------------------**& ReportZSLMKEY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORTZSLMKEY.

types: begin of dswpclientkey,
         INSTNO type num10,
         DBID(3),
         BUNDLE_ID(8),
         SERVICE_KEY(40),
       end of dswpclientkey.
*data: dswpclientkey_w type standard table of dswpclientkey.
DATA: P_VALUE(10),
      P_INSTNO(10).

PARAMETERS: P_SID(3),
             P_SYSNO(2),
             P_SERVER(15).

START-OF-SELECTION.
PERFORM GET_SP_VALUE USING P_SID
                           P_SYSNO
                           P_SERVER
                           P_INSTNO
                  CHANGING P_VALUE.

END-OF-SELECTION.
WRITE P_VALUE.
*&---------------------------------------------------------------------*
*&      Formget_sp_value
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PF_SIDtext
*      -->P_PF_SYSNOtext
*      -->P_PF_SERVERtext
*      create( encoding = '1100' ).
lf_len = STRLEN( lf_string ).

IF lf_string(lf_len) CN lc_allowed_chars.
else.

* Fold the input string to a lc_part_len long string
    WHILE lf_len > 0.
      lf_part = lf_string(lc_part_len).
      SHIFT lf_string BY lc_part_len PLACES.
      lf_len = STRLEN( lf_string ).
      CALL METHOD lo_conv_to_x->reset.
      CALL METHOD lo_conv_to_x->write( data = lf_part n = -1 ).
      lf_xbuffer = lo_conv_to_x->get_buffer( ).
      lf_finalx = lf_finalx BIT-XOR lf_xbuffer.
    ENDWHILE.

    lf_key = 12.

    PERFORM scramble USING      lf_finalx
                              lf_key
                              lc_part_len
                     CHANGING lf_finalf
                              lf_subrc.

    if not lf_finalf is initial.
      p_pf_value = lf_finalf.
      ls_key-dbid      = p_pf_sid.
      ls_key-instno      = p_pf_instno.
      ls_key-bundle_id   = 'SM_KEY'.
      ls_key-service_key = lf_finalf.
      if not p_pf_instno is initial.
*      insert dswpclientkey_w from ls_key.
      if sy-subrc0.
*          update dswpclientkey_w from ls_key.
      endif.
      endif.
    else.
      clear p_pf_value.
    endif.
endif.
ENDFORM.                  " get_sp_value
*&---------------------------------------------------------------------*
*&      Formscramble
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_LF_FINALXtext
*      -->P_LF_KEYtext
*      -->P_LC_PART_LENtext
*
页: [1]
查看完整版本: SAP学习笔记