Input variable is mandatory, as that is what users want. If they enter no date, then all data must come back, or else they must have the option of selecting date, hence making it optional.
Here is the code for the customer exit variable:
function zbi_postpopup_zceion333.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_VNAM) LIKE RSZGLOBV-VNAM
*" VALUE(I_VARTYP) LIKE RSZGLOBV-VARTYP
*" VALUE(I_IOBJNM) LIKE RSZGLOBV-IOBJNM
*" VALUE(I_S_COB_PRO) TYPE RSD_S_COB_PRO
*" VALUE(I_S_RKB1D) TYPE RSR_S_RKB1D
*" VALUE(I_PERIV) TYPE RRO01_S_RKB1F-PERIV
*" VALUE(I_T_VAR_RANGE) TYPE RRS0_T_VAR_RANGE
*" VALUE(I_STEP) TYPE I DEFAULT 0
*" EXPORTING
*" VALUE(E_T_RANGE) TYPE RSR_T_RANGESID
*" VALUE(E_MEEHT) LIKE RSZGLOBV-MEEHT
*" VALUE(E_MEFAC) LIKE RSZGLOBV-MEFAC
*" VALUE(E_WAERS) LIKE RSZGLOBV-WAERS
*" VALUE(E_WHFAC) LIKE RSZGLOBV-WHFAC
*" CHANGING
*" REFERENCE(C_S_CUSTOMER) TYPE RRO04_S_CUSTOMER
*"----------------------------------------------------------------------
*-----------------------------------------------------------------------
* ** Andrew Lewis - 15th January 2014
* ** Derive a date range, based on input from user
* ** User could enter just the FROM / TO date, and in that scenario
* ** WebI ignores the range
* **
* ** Date From Date To Desired Output
* ** ---------- ---------- ---------------
* ** 01.01.2014 12.01.2014 01.01.2014 -> 12.01.2014
* ** 01.01.2014 01.01.2014 -> 01.01.2014
* ** 10.01.2014 10.01.2014 -> 10.01.2014
*-----------------------------------------------------------------------
** Determine the same week for the previous year
include zbi_variables.
data:
ld_date_low type dats,
ld_date_high type dats.
loop at i_t_var_range assigning <ls_var_range> where vnam = 'ZCMIOY156'.
" only proceed if at least 1 value (low/high) is populated
check <ls_var_range>-low is not initial or <ls_var_range>-high is not initial.
ls_bwrange-sign = 'I'.
ls_bwrange-opt = 'BT'.
" map low value, if empty, use high value
if <ls_var_range>-low is not initial.
ls_bwrange-low = <ls_var_range>-low.
else.
if <ls_var_range>-high is not initial.
ls_bwrange-low = <ls_var_range>-high.
endif.
endif.
" map high value. If empty, use the low value
if <ls_var_range>-high is not initial.
ls_bwrange-high = <ls_var_range>-high.
else.
if <ls_var_range>-low is not initial.
ls_bwrange-high = <ls_var_range>-low.
endif.
endif.
" only append restriction if something was determined
check ls_bwrange-low is not initial and ls_bwrange-high is not initial.
" add date restriction to output table
append ls_bwrange to e_t_range.
endloop.
endfunction.