*&---------------------------------------------------------------------*
*& Report zonline
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
report zonline.
data: text type string,
time type i.
time = 0.
parameters s_time type p default 3800.
initialization.
start-of-selection.
if sy-langu = '1'.
concatenate '此程序是为了使SAP保持在线,请使用其他会话进行工作' '!' into text.
else.
concatenate 'Please use another session for working' '!' into text.
endif.
data:gt_info type table of uinfo2,
gv_num type i.
"获取当前用户的会话数
call function 'TH_LONG_USR_INFO'
exporting
user = sy-uname
tables
user_info = gt_info.
describe table gt_info lines gv_num.
"对当前打开的会话数进行判断,如果只打开了一个,那么再另外打开一个新的会话供用户使用
if gv_num = 1.
call function 'TH_CREATE_FOREIGN_MODE'
exporting
client = sy-mandt
user = sy-uname
* TCODE =
* RETURN_ERROR = 1
* CREATE_EXCLUSIVE = 0
exceptions
user_not_found = 1
cant_create_mode = 2
others = 3.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
endif.
data k type i.
do.
k = k + 1.
if k >= s_time and s_time > 0.
message '对话框停留时间结束'type 'S'.
exit.
endif.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = time
text = text
exceptions
others = 1.
time = time + 1.
if time = 101.
time = 0.
endif.
wait up to 60 seconds.
enddo.