*"----------------------------------------------------------------------
*" Программа заполняет фильтр по CALDAY из переменной
*" ZSO_NORKORSA_PERIOD из таблицы TVARVC.
*-----------------------------------------------------------------------
data:
l_idx like sy-tabix,
l_dfrom type d,
l_dto type d,
l_char10 type c length 10. "Для преобразования даты
*-----------------------------------------------------------------------
read table l_t_range
with key fieldname = 'CALDAY'.
l_idx = sy-tabix.
select single low
from tvarvc
into l_char10
where name = 'ZSO_NORKORSA_PERIOD'.
*" Обработка формата даты с точками
if strlen( l_char10 ) = 10.
concatenate l_char10+6(4) "Год
l_char10+3(2) "Месяц
l_char10+0(2) "День
into l_char10.
endif.
l_dfrom = l_char10.
select single high
from tvarvc
into l_char10
where name = 'ZSO_NORKORSA_PERIOD'.
*" Обработка формата даты с точками
if strlen( l_char10 ) = 10.
concatenate l_char10+6(4) "Год
l_char10+3(2) "Месяц
l_char10+0(2) "День
into l_char10.
endif.
l_dto = l_char10.
l_t_range-iobjnm = '0CALDAY'.
l_t_range-fieldname = 'CALDAY'.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
l_t_range-low = l_dfrom.
l_t_range-high = l_dto.
*-----------------------------------------------------------------------
if l_idx <> 0.
modify l_t_range index l_idx.
else.
append l_t_range.
endif.
p_subrc = 0.
*-----------------------------------------------------------------------
Второй способ:
program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
form f_check_date
using p_dt type rvari_val_255.
data:
lv_dt type d.
try. "лишний
lv_dt = p_dt.
call function 'DATE_CHECK_PLAUSIBILITY' "Проверяем корректность значения
exporting
date = lv_dt.
p_dt = lv_dt.
endtry. "лишний
endform.
*$*$ end of global - insert your declaration only before this line *-*
* -------------------------------------------------------------------
* Fieldname = /BIC/ZBLDAT
* data type = DATS
* length = 000008
* -------------------------------------------------------------------
form c_/bic/zbldat
tables l_t_range structure rssdlrange
using i_r_request type ref to if_rsbk_request_admintab_view
i_fieldnm type rsfieldnm
changing p_subrc like sy-subrc.
* Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line *-*
data:
ls_tvarvc_row type tvarvc,
lv_dt type d,
lv_idx type sy-tabix.
data:
ls_range_row like line of l_t_range.
break-point id break.
read table l_t_range
into ls_range_row
with key fieldname = i_fieldnm.
lv_idx = sy-tabix.
select single *
from tvarvc
into ls_tvarvc_row
where name eq 'ZSO_OTM_INV_INTEGR_DATES'
and type eq 'S'
.
try. "Для обработки исключений
perform f_check_date
using ls_tvarvc_row-low.
catch cx_root.
message 'Invalid date format. TVARVC variable'
&& ' ZSO_OTM_INV_INTEGR_DATES-low'
type 'I'.
p_subrc = 8.
return.
endtry.
try.
perform f_check_date
using ls_tvarvc_row-high.
catch cx_root.
message 'Invalid date format. TVARVC variable'
&& ' ZSO_OTM_INV_INTEGR_DATES-high'
type 'I'.
p_subrc = 8.
return.
endtry.
if ls_tvarvc_row-high is not initial.
endif.
ls_range_row-iobjnm = 'ZBLDAT1'.
ls_range_row-fieldname = i_fieldnm.
if ls_tvarvc_row-sign is initial.
ls_range_row-sign = 'I'.
else.
ls_range_row-sign = ls_tvarvc_row-sign.
endif.
if ls_tvarvc_row-opti is initial
and ls_tvarvc_row-high = '00000000'.
ls_tvarvc_row-opti = 'EQ'.
clear ls_tvarvc_row-high.
elseif ls_tvarvc_row-opti is initial.
ls_tvarvc_row-opti = 'BT'.
endif.
ls_range_row-option = ls_tvarvc_row-opti.
ls_range_row-low = ls_tvarvc_row-low.
ls_range_row-high = ls_tvarvc_row-high.
if lv_idx ne 0.
modify l_t_range[] from ls_range_row index lv_idx.
else.
append ls_range_row to l_t_range[].
endif.
p_subrc = 0.
*$*$ end of routine - insert your code only before this line *-*
endform.
*" Программа заполняет фильтр по CALDAY из переменной
*" ZSO_NORKORSA_PERIOD из таблицы TVARVC.
*-----------------------------------------------------------------------
data:
l_idx like sy-tabix,
l_dfrom type d,
l_dto type d,
l_char10 type c length 10. "Для преобразования даты
*-----------------------------------------------------------------------
read table l_t_range
with key fieldname = 'CALDAY'.
l_idx = sy-tabix.
select single low
from tvarvc
into l_char10
where name = 'ZSO_NORKORSA_PERIOD'.
*" Обработка формата даты с точками
if strlen( l_char10 ) = 10.
concatenate l_char10+6(4) "Год
l_char10+3(2) "Месяц
l_char10+0(2) "День
into l_char10.
endif.
l_dfrom = l_char10.
select single high
from tvarvc
into l_char10
where name = 'ZSO_NORKORSA_PERIOD'.
*" Обработка формата даты с точками
if strlen( l_char10 ) = 10.
concatenate l_char10+6(4) "Год
l_char10+3(2) "Месяц
l_char10+0(2) "День
into l_char10.
endif.
l_dto = l_char10.
l_t_range-iobjnm = '0CALDAY'.
l_t_range-fieldname = 'CALDAY'.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
l_t_range-low = l_dfrom.
l_t_range-high = l_dto.
*-----------------------------------------------------------------------
if l_idx <> 0.
modify l_t_range index l_idx.
else.
append l_t_range.
endif.
p_subrc = 0.
*-----------------------------------------------------------------------
Второй способ:
program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line *-*
* TABLES: ...
* DATA: ...
form f_check_date
using p_dt type rvari_val_255.
data:
lv_dt type d.
try. "лишний
lv_dt = p_dt.
call function 'DATE_CHECK_PLAUSIBILITY' "Проверяем корректность значения
exporting
date = lv_dt.
p_dt = lv_dt.
endtry. "лишний
endform.
*$*$ end of global - insert your declaration only before this line *-*
* -------------------------------------------------------------------
* Fieldname = /BIC/ZBLDAT
* data type = DATS
* length = 000008
* -------------------------------------------------------------------
form c_/bic/zbldat
tables l_t_range structure rssdlrange
using i_r_request type ref to if_rsbk_request_admintab_view
i_fieldnm type rsfieldnm
changing p_subrc like sy-subrc.
* Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line *-*
data:
ls_tvarvc_row type tvarvc,
lv_dt type d,
lv_idx type sy-tabix.
data:
ls_range_row like line of l_t_range.
break-point id break.
read table l_t_range
into ls_range_row
with key fieldname = i_fieldnm.
lv_idx = sy-tabix.
select single *
from tvarvc
into ls_tvarvc_row
where name eq 'ZSO_OTM_INV_INTEGR_DATES'
and type eq 'S'
.
try. "Для обработки исключений
perform f_check_date
using ls_tvarvc_row-low.
catch cx_root.
message 'Invalid date format. TVARVC variable'
&& ' ZSO_OTM_INV_INTEGR_DATES-low'
type 'I'.
p_subrc = 8.
return.
endtry.
try.
perform f_check_date
using ls_tvarvc_row-high.
catch cx_root.
message 'Invalid date format. TVARVC variable'
&& ' ZSO_OTM_INV_INTEGR_DATES-high'
type 'I'.
p_subrc = 8.
return.
endtry.
if ls_tvarvc_row-high is not initial.
endif.
ls_range_row-iobjnm = 'ZBLDAT1'.
ls_range_row-fieldname = i_fieldnm.
if ls_tvarvc_row-sign is initial.
ls_range_row-sign = 'I'.
else.
ls_range_row-sign = ls_tvarvc_row-sign.
endif.
if ls_tvarvc_row-opti is initial
and ls_tvarvc_row-high = '00000000'.
ls_tvarvc_row-opti = 'EQ'.
clear ls_tvarvc_row-high.
elseif ls_tvarvc_row-opti is initial.
ls_tvarvc_row-opti = 'BT'.
endif.
ls_range_row-option = ls_tvarvc_row-opti.
ls_range_row-low = ls_tvarvc_row-low.
ls_range_row-high = ls_tvarvc_row-high.
if lv_idx ne 0.
modify l_t_range[] from ls_range_row index lv_idx.
else.
append ls_range_row to l_t_range[].
endif.
p_subrc = 0.
*$*$ end of routine - insert your code only before this line *-*
endform.
Комментариев нет:
Отправить комментарий