Hello Experts,
I have this requirement where I need a Balance brought forward.
I have build a query on 0FI_GL_14 to a customised DSO.
Now the report input selection screen has
Comp code.
Vendor.
customer.
Fiscal year period.
I have to fetch balance brought forward for the combination for comp code 5110 , vendor 5114 and fiscper 012.2013 which means I have to check the closing balance of the previous period.
Now I have a scenario where I have entries in my DSO for 010.2013 and 012.2013 and no entries for 011.2013 for the combination entered in the selection
The balance brought forward for the period 012.2013 should check for period 011.2013 as there are no values it has to fetch 010.2013 values.
I am using KPI Debeit credit amount for the balance brought forward.
I have build a query where I have implemented Exit variable under the KPI balance brought forward with the char fiscper and written the code to check for the previous periods and fetch the data.This is working fine when ever there is a balance in the previous periods.but when there is no balance for the combination I need( comp code 5110, vendor 5114 and fiscper 012.2013) its fetching empty values as the exit is not checking for the 010.2013 values.
This is because I have entries in my DSO for 011.2013 for other combination which is comp code 5110, vendor 5105 hence the code is getting exit and retrieving no values.
how can I achieve this please suggest the ideas.
Exit variable code.
DATA: zfiscper TYPE /bi0/oifiscper,
lv_len TYPE i.
IF i_step = 2.
READ TABLE i_t_var_range INTO loc_var_range
WITH KEY vnam = 'YVAR_FISCPER_ME'.
IF sy-subrc = 0.
loc_var_range-low = loc_var_range-low - 1.
IF ( loc_var_range-low+4(3) = '000' ).
loc_var_range-low+0(4) = loc_var_range-low+0(4) - 1.
loc_var_range-low+4(3) = '012'.
ENDIF.
zfiscper = loc_var_range-low.
DO.
SELECT COUNT(*) FROM /bic/ayfiglbs100 WHERE fiscper = zfiscper.
IF sy-subrc = 0.
EXIT.
ELSE.
zfiscper = zfiscper - 1.
ENDIF.
ENDDO.
l_s_range-low = zfiscper.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
CLEAR l_s_range.
ENDIF.
ENDIF.
ENDFUNCTION.
Thanks,
Santhosh