登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

原来为了你

我的人生就是要一次次的超越

 
 
 

日志

 
 
 
 

ABAP源代码的加密与解密  

2011-07-30 17:41:01|  分类: ABAP基础知识 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

report  z_encode_decode_program"解密后中文易出现乱码..


parametersprogram(100).
parametersp_encode radiobutton group g1 modif id g1,
            p_decode 
radiobutton group g1 modif id g1.

if p_encode 'X'.
  
perform frm_encode_program.
elseif p_decode 'X'.
  
perform frm_decode_program.
endif.

*----------------------- Encode ----------------------------------------
form frm_encode_program.
  
data:begin of itab occurs 0,
        
line(72).
  
data:end of itab.
  
data g_in type string.
  
data g_out type xstring.
  
data g_c type string.
  
data g_line type i.
  
data g_x type i.

  
read report program into itab.
  
loop at itab.
    g_line 
strlenitab-line ).
    
clear g_x.
    
do g_line times.
      g_c 
itab-line+g_x(1).
      
if not g_c is initial.
        
call function 'HR_KR_STRING_TO_XSTRING'
          
exporting
            codepage_to      
'8500'
            unicode_string   
g_c
            out_len          
0
          
importing
            xstring_stream   
g_out
          
exceptions
            invalid_codepage 
1
            invalid_string   
2
            
others           3.
        g_out 
g_out 1.
        
call function 'HR_KR_XSTRING_TO_STRING'
          
exporting
            from_codepage 
'8500'
            in_xstring    
g_out
            out_len       
0
          
importing
            out_string    
g_in.
        itab
-line+g_x(1) = g_in.
      
endif.
      g_x 
g_x + 1.
    
enddo.
    
modify itab.
    
write itab-line.
  
endloop.
  
insert report program from itab.
endform.                    "frm_encode_program

*----------------------- Decode ----------------------------------------
form frm_decode_program.
  
data:begin of itab occurs 0,
        
line(72).
  
data:end of itab.
  
data g_in type string.
  
data g_out type xstring.
  
data g_c type string.
  
data g_line type i.
  
data g_x type i.
  
read report program into itab.
  
loop at itab.
    g_line 
strlenitab-line ).
    
clear g_x.
    
do g_line times.
      g_c 
itab-line+g_x(1).
      
if not g_c is initial.
        
call function 'HR_KR_STRING_TO_XSTRING'
          
exporting
            codepage_to      
'8500'
            unicode_string   
g_c
            out_len          
0
          
importing
            xstring_stream   
g_out
          
exceptions
            invalid_codepage 
1
            invalid_string   
2
            
others           3.
        g_out 
g_out + 1.
        
call function 'HR_KR_XSTRING_TO_STRING'
          
exporting
            from_codepage 
'8500'
            in_xstring    
g_out
            out_len       
0
          
importing
            out_string    
g_in.
        itab
-line+g_x(1) = g_in.
      
endif.
      g_x 
g_x + 1.
    
enddo.
    
modify itab.
    
write itab-line.
  
endloop.
  
insert report program from itab.
endform.                    "frm_encode_program

  评论这张
 
阅读(1767)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018