Может понадобиться функционал блокировки пользователей, в момент загрузки данных. Например, если хранилищ несколько и загружаются они параллельно, или когда удаляем индексы с кубов, а пользователь запускает в этот момент отчет.
Для начала в CMOD добавляем include:
Ссылка
*&---------------------------------------------------------------------*
*& Include Z_LOCKDATA
*&---------------------------------------------------------------------*
"$ Region BREAK Session when load SO
DATA:
l_uploadstatus TYPE c VALUE lx
, l_cubelist TYPE RANGE OF rsinfocube
, ls_cubelist LIKE LINE OF l_cubelist
, lt_tmplist TYPE STANDARD TABLE OF rsinfocube
, l_so_report TYPE c VALUE space
, l_itmp1 TYPE i
, l_itmp2 TYPE i
.
FIELD-SYMBOLS:
<ls_tmplist> TYPE rsinfocube
.
CONSTANTS:
lso_infoarea TYPE string VALUE 'YIA_SO_REP'
.
CALL FUNCTION 'Z_GET_CUSTOMER_PARAMETER'
EXPORTING
constant_name = 'ZBW_SO_UPLOADSTATUS'
default_value = lx
* SOURCE_TABLE = 'TVARVC'
IMPORTING
result_parameter = l_uploadstatus
.
IF l_uploadstatus = lx.
"Get user list for SO
GET PARAMETER ID 'ZSO_REPORT' FIELD l_so_report.
IF l_so_report = space.
* prepare structure
CLEAR ls_cubelist.
ls_cubelist-sign = 'I'.
ls_cubelist-option = 'EQ'.
* "get cube list for SO
* CALL FUNCTION 'Z_GET_CUSTOMER_SELECT_OPTION'
* EXPORTING
* constant_name = 'ZBW_SO_CUBELIST'
* "DEFAULT_VALUE = 'DUMMY'
* "source_table = 'TVARVC'
* TABLES
* result_range = l_cubelist.
SELECT DISTINCT infocube
FROM rsdcube
INTO TABLE lt_tmplist
WHERE infoarea = lso_infoarea.
IF lt_tmplist[] IS NOT INITIAL.
LOOP AT lt_tmplist
ASSIGNING <ls_tmplist>.
ls_cubelist-low = <ls_tmplist>.
COLLECT ls_cubelist INTO l_cubelist.
ENDLOOP.
ENDIF.
SELECT DISTINCT odsobject
FROM rsdodso
INTO TABLE lt_tmplist
WHERE infoarea = lso_infoarea.
IF lt_tmplist[] IS NOT INITIAL.
LOOP AT lt_tmplist
ASSIGNING <ls_tmplist>.
ls_cubelist-low = <ls_tmplist>.
COLLECT ls_cubelist INTO l_cubelist.
ENDLOOP.
ENDIF.
SELECT DISTINCT infoset
FROM rsqiset
INTO TABLE lt_tmplist
WHERE infoarea = lso_infoarea.
IF lt_tmplist[] IS NOT INITIAL.
LOOP AT lt_tmplist
ASSIGNING <ls_tmplist>.
ls_cubelist-low = <ls_tmplist>.
COLLECT ls_cubelist INTO l_cubelist.
ENDLOOP.
ENDIF.
IF i_s_rkb1d-infocube IN l_cubelist.
IF sy-langu = 'R'.
MESSAGE ID 'ZDBW_MESS' TYPE 'E' NUMBER '003'
WITH 'Data load have not finished, yet!' 'Your session is been interrupt!' 'Support Team.'.
" WITH 'Загрузка ещё не закончена!' 'Ваша сессия будет прервана!' 'СП.'.
ELSE.
MESSAGE ID 'ZDBW_MESS' TYPE 'E' NUMBER '003'
WITH 'Data load have not finished, yet!' 'Your session is been interrupt!' 'Support Team.'.
ENDIF.
ENDIF. "IF I_S_RKB1D IN l_cubelist.
ENDIF.
ENDIF. "IF l_uploadstatus = 'X'.
"$ Endregion BREAK Session when load SO
Не забываем про ФМ:
FUNCTION z_get_customer_parameter.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(CONSTANT_NAME)
*" VALUE(DEFAULT_VALUE) DEFAULT 'DUMMY'
*" VALUE(SOURCE_TABLE) DEFAULT 'TVARVC'
*" EXPORTING
*" VALUE(RESULT_PARAMETER)
*"----------------------------------------------------------------------
DATA:
l_low TYPE tvarv_val
, l_dummy_type TYPE rsscr_kind
, l_dummy_numb TYPE tvarv_numb
.
SELECT low
type numb UP TO 1 ROWS
INTO (l_low,
l_dummy_type, l_dummy_numb)
FROM (source_table)
WHERE name = constant_name
AND ( type = c_selection_type_parameter "'P'
OR type = c_selection_type_sel_option ) "'S'
ORDER BY type "Type of selection: 'P'/'S'
numb "Current selection number
.
* EXIT.
ENDSELECT.
IF sy-subrc = 0.
result_parameter = l_low.
ELSE. "Nothing found in the source table...
result_parameter = default_value.
ENDIF.
ENDFUNCTION.
Включить ФМ в вашу функциональную группу Z-овских ФМ.
В STVARV реагируем на значение переменноq ZBW_SO_UPLOADSTATUS = Х или пусто.
В профиль пользователя, в параметры, добавляем ZSO_REPORT = Х, если пользователь должен все равно иметь доступ к отчетам. (http://scn.sap.com/thread/142631)
Смысл - ограничиваем доступ к инфо-провайдерам из указанной Info-area.
Но нам ничего не мешает скопировать мультик в другую область и запускать отчеты с него, при блокировке.
Для начала в CMOD добавляем include:
Ссылка
*&---------------------------------------------------------------------*
*& Include Z_LOCKDATA
*&---------------------------------------------------------------------*
"$ Region BREAK Session when load SO
DATA:
l_uploadstatus TYPE c VALUE lx
, l_cubelist TYPE RANGE OF rsinfocube
, ls_cubelist LIKE LINE OF l_cubelist
, lt_tmplist TYPE STANDARD TABLE OF rsinfocube
, l_so_report TYPE c VALUE space
, l_itmp1 TYPE i
, l_itmp2 TYPE i
.
FIELD-SYMBOLS:
<ls_tmplist> TYPE rsinfocube
.
CONSTANTS:
lso_infoarea TYPE string VALUE 'YIA_SO_REP'
.
CALL FUNCTION 'Z_GET_CUSTOMER_PARAMETER'
EXPORTING
constant_name = 'ZBW_SO_UPLOADSTATUS'
default_value = lx
* SOURCE_TABLE = 'TVARVC'
IMPORTING
result_parameter = l_uploadstatus
.
IF l_uploadstatus = lx.
"Get user list for SO
GET PARAMETER ID 'ZSO_REPORT' FIELD l_so_report.
IF l_so_report = space.
* prepare structure
CLEAR ls_cubelist.
ls_cubelist-sign = 'I'.
ls_cubelist-option = 'EQ'.
* "get cube list for SO
* CALL FUNCTION 'Z_GET_CUSTOMER_SELECT_OPTION'
* EXPORTING
* constant_name = 'ZBW_SO_CUBELIST'
* "DEFAULT_VALUE = 'DUMMY'
* "source_table = 'TVARVC'
* TABLES
* result_range = l_cubelist.
SELECT DISTINCT infocube
FROM rsdcube
INTO TABLE lt_tmplist
WHERE infoarea = lso_infoarea.
IF lt_tmplist[] IS NOT INITIAL.
LOOP AT lt_tmplist
ASSIGNING <ls_tmplist>.
ls_cubelist-low = <ls_tmplist>.
COLLECT ls_cubelist INTO l_cubelist.
ENDLOOP.
ENDIF.
SELECT DISTINCT odsobject
FROM rsdodso
INTO TABLE lt_tmplist
WHERE infoarea = lso_infoarea.
IF lt_tmplist[] IS NOT INITIAL.
LOOP AT lt_tmplist
ASSIGNING <ls_tmplist>.
ls_cubelist-low = <ls_tmplist>.
COLLECT ls_cubelist INTO l_cubelist.
ENDLOOP.
ENDIF.
SELECT DISTINCT infoset
FROM rsqiset
INTO TABLE lt_tmplist
WHERE infoarea = lso_infoarea.
IF lt_tmplist[] IS NOT INITIAL.
LOOP AT lt_tmplist
ASSIGNING <ls_tmplist>.
ls_cubelist-low = <ls_tmplist>.
COLLECT ls_cubelist INTO l_cubelist.
ENDLOOP.
ENDIF.
IF i_s_rkb1d-infocube IN l_cubelist.
IF sy-langu = 'R'.
MESSAGE ID 'ZDBW_MESS' TYPE 'E' NUMBER '003'
WITH 'Data load have not finished, yet!' 'Your session is been interrupt!' 'Support Team.'.
" WITH 'Загрузка ещё не закончена!' 'Ваша сессия будет прервана!' 'СП.'.
ELSE.
MESSAGE ID 'ZDBW_MESS' TYPE 'E' NUMBER '003'
WITH 'Data load have not finished, yet!' 'Your session is been interrupt!' 'Support Team.'.
ENDIF.
ENDIF. "IF I_S_RKB1D IN l_cubelist.
ENDIF.
ENDIF. "IF l_uploadstatus = 'X'.
"$ Endregion BREAK Session when load SO
Не забываем про ФМ:
FUNCTION z_get_customer_parameter.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(CONSTANT_NAME)
*" VALUE(DEFAULT_VALUE) DEFAULT 'DUMMY'
*" VALUE(SOURCE_TABLE) DEFAULT 'TVARVC'
*" EXPORTING
*" VALUE(RESULT_PARAMETER)
*"----------------------------------------------------------------------
DATA:
l_low TYPE tvarv_val
, l_dummy_type TYPE rsscr_kind
, l_dummy_numb TYPE tvarv_numb
.
SELECT low
type numb UP TO 1 ROWS
INTO (l_low,
l_dummy_type, l_dummy_numb)
FROM (source_table)
WHERE name = constant_name
AND ( type = c_selection_type_parameter "'P'
OR type = c_selection_type_sel_option ) "'S'
ORDER BY type "Type of selection: 'P'/'S'
numb "Current selection number
.
* EXIT.
ENDSELECT.
IF sy-subrc = 0.
result_parameter = l_low.
ELSE. "Nothing found in the source table...
result_parameter = default_value.
ENDIF.
ENDFUNCTION.
Включить ФМ в вашу функциональную группу Z-овских ФМ.
В STVARV реагируем на значение переменноq ZBW_SO_UPLOADSTATUS = Х или пусто.
В профиль пользователя, в параметры, добавляем ZSO_REPORT = Х, если пользователь должен все равно иметь доступ к отчетам. (http://scn.sap.com/thread/142631)
Смысл - ограничиваем доступ к инфо-провайдерам из указанной Info-area.
Но нам ничего не мешает скопировать мультик в другую область и запускать отчеты с него, при блокировке.
Комментариев нет:
Отправить комментарий