*&---------------------------------------------------------------------*
*& Report ZSLMKEY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZSLMKEY.
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.
*&---------------------------------------------------------------------*
*& Form get_sp_value
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_PF_SID text
* -->P_PF_SYSNO text
* -->P_PF_SERVER text
* 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-subrc 0.
* update dswpclientkey_w from ls_key.
endif.
endif.
else.
clear p_pf_value.
endif.
endif.
ENDFORM. " get_sp_value
*&---------------------------------------------------------------------*
*& Form scramble
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LF_FINALX text
* -->P_LF_KEY text
* -->P_LC_PART_LEN text
* |