In a cutomer Exit Variable how to consider other variable value at Runtime.
Scenario:
The are some case when creating a customer exit variable we need to consider other variable value at run time.
Requirement:
Create a FI-AR or FI-AP aging report . In which we need to create aging buckets . We consider Posting Date , Document Date and Cleared Dates to calculate
Balances.Our requirement to consider Document date value which calculating clearing date and posting date.
step 1 :
Create a variable for Document date calculation.
code :
data: v_date type sy–datum,
v_qtr(2) type c,
wa like LINE OF i_t_var_range,
l_s_range like line of e_t_range,
v_day type n length 2,
v_year type n length 4,
p_year type n length 4,
l_vnam TYPE rszglobv–vnam.
constants: c_varname type rszvnam value ‘ZVAR_DOC_DATET’,
c_iobjnm type rsiobjnm value ‘0DOC_DATE’.
if i_step = 0 or i_step = 1.
l_vnam = i_vnam.
IF l_vnam = ‘ZVAR_DOC_DATET’.
*Read System Date
l_s_range–low = sy–datum.
l_s_range–sign = ‘I’.
l_s_range–opt = ‘EQ’.
APPEND l_s_range TO e_t_range.
endif.
endif.
*} INSERT
ENDFUNCTION.
step 2 :
: Call the Document date variable value into clearing date calculation ( The FM also created exactly in same manner).
user the same parameters like ‘Z_*_ZVAR_DOC_DATET’.
code :
data: wa like LINE OF i_t_var_range,
l_s_range like line of e_t_range,
l_vnam TYPE rszglobv–vnam.
constants: c_varname type rszvnam value ‘ZVAR_DOC_DATET’,
c_iobjnm type rsiobjnm value ‘0DOC_DATE’.
if i_step = 1.
clear: l_s_range.
l_vnam = i_vnam.
IF l_vnam = ‘ZVAR_CLEAR_DATE3’.
* Read the variable ZVAR_DOC_DATET value.
loop at i_t_var_range into wa
where vnam = c_varname
and iobjnm = c_iobjnm.
endloop.
if sy–subrc = 0.
l_s_range–low = wa–low.
l_s_range–sign = ‘I’.
l_s_range–opt = ‘EQ’.
APPEND l_s_range TO e_t_range.
endif.
endif.
elseif i_step = 0.
l_s_range–low = sy–datum.
l_s_range–sign = ‘I’.
l_s_range–opt = ‘EQ’.
APPEND l_s_range TO e_t_range.
ENDIF.
*} INSERT
ENDFUNCTION.
In this we call the value of variable ‘ZVAR_DOC_DATET’ into a loop over.And used that value into our required variable .
Note : Make sure ‘RSR00001 BI: Enhancements for Global Variables in Reporting’ is developed in a way to support variable call as Function module.
we can also use the same approach in our traditional variable calculation also.
Hope this Helps!
Anjaneyulu Kanta