HKEY_CURRENT_USER\Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer
另外,HKEY_CURRENT_USER\Software\SAP\SAPGUI Front\SAP Frontend Server\Code下面放的是最近执行的TCODE,即命令栏Comobox里面的
REPORT z_barry_regedit.
PARAMETERS : p1(150) TYPE c OBLIGATORY ,
p2(150) TYPE c OBLIGATORY ,
p3(150) TYPE c OBLIGATORY .
DATA:pstr TYPE string ,
rc TYPE i , rcc TYPE c ,
ans TYPE c .
INITIALIZATION.
PERFORM get_reg.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p1.
PERFORM get_path_f4 USING p1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p2.
PERFORM get_path_f4 USING p2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p3.
PERFORM get_path_f4 USING p3.
AT SELECTION-SCREEN.
PERFORM check_directory_exist USING p1 rcc .
IF rcc = ''.
MESSAGE e000(oo) WITH 'Path路径不存在!'.
ENDIF.
PERFORM check_directory_exist USING p2 rcc .
IF rcc = ''.
MESSAGE e000(oo) WITH 'PathDownload路径不存在!'.
ENDIF.
PERFORM check_directory_exist USING p3 rcc .
IF rcc = ''.
MESSAGE e000(oo) WITH 'PathUpload路径不存在!'.
ENDIF.
START-OF-SELECTION.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = '确认更新'
text_question = '确认更新数据?'
IMPORTING
answer = ans.
IF ans <> '1' .
LEAVE PROGRAM .
ENDIF .
PERFORM set_reg.
*&---------------------------------------------------------------------*
*& Form get_path
*&---------------------------------------------------------------------*
FORM get_path_f4 USING para .
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'File Directory'
initial_folder = 'C:\'
CHANGING
selected_folder = pstr.
CALL METHOD cl_gui_cfw=>flush.
para = pstr .
ENDFORM. " get_path
*&---------------------------------------------------------------------*
*& Form check_DIRECTORY_EXIST
*&---------------------------------------------------------------------*
FORM check_directory_exist USING p result .
pstr = p.
CALL METHOD cl_gui_frontend_services=>directory_exist
EXPORTING
directory = pstr
RECEIVING
result = result.
ENDFORM. " check_DIRECTORY_EXIST
*&---------------------------------------------------------------------*
*& Form get_reg
*&---------------------------------------------------------------------*
FORM get_reg.
CALL METHOD cl_gui_frontend_services=>registry_get_value
EXPORTING
root = cl_gui_frontend_services=>hkey_current_user
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer'
value = 'Path'
IMPORTING
reg_value = pstr.
p1 = pstr.
CLEAR pstr.
CALL METHOD cl_gui_frontend_services=>registry_get_value
EXPORTING
root = cl_gui_frontend_services=>hkey_current_user
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer'
value = 'PathDownload'
IMPORTING
reg_value = pstr.
p2 = pstr.
CLEAR pstr.
CALL METHOD cl_gui_frontend_services=>registry_get_value
EXPORTING
root = cl_gui_frontend_services=>hkey_current_user
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer'
value = 'PathUpload'
IMPORTING
reg_value = pstr.
CALL METHOD cl_gui_cfw=>flush.
p3 = pstr.
ENDFORM. "get_reg
*&---------------------------------------------------------------------*
*& Form set_reg
*&---------------------------------------------------------------------*
FORM set_reg .
CLEAR pstr.
pstr = p1 .
CALL METHOD cl_gui_frontend_services=>registry_set_value
EXPORTING
root = cl_gui_frontend_services=>hkey_current_user
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer'
value_name = 'Path'
value = pstr
IMPORTING
rc = rc.
CLEAR pstr.
pstr = p2 .
CALL METHOD cl_gui_frontend_services=>registry_set_value
EXPORTING
root = cl_gui_frontend_services=>hkey_current_user
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer'
value_name = 'PathDownload'
value = pstr
IMPORTING
rc = rc.
CLEAR pstr.
pstr = p3 .
CALL METHOD cl_gui_frontend_services=>registry_set_value
EXPORTING
root = cl_gui_frontend_services=>hkey_current_user
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Filetransfer'
value_name = 'PathUpload'
value = pstr
IMPORTING
rc = rc.
CALL METHOD cl_gui_cfw=>flush.
ENDFORM. " set_reg
阅读(3054) | 评论(0) | 转发(0) |