on 2014 Feb 10 11:23 AM
HI
I need to create a variable which will fetch me the data for last fiscal year
e.g, current month : 02.2014
it should fetch me the data for 02.2012 to 02.2013..
Any hints on how to write this logic in the customer exit?/
i can derive high value as below- but need help on how to define low value ?
WHEN 'ZPYTD'.
CLEAR: date_py.
date_py = sy-datum - 365.
l_s_range-high = date_py.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
IS there a way to achieve this by on the basis of sy-datam.?
for eg..if i execute the report on 10 feb, it should give me the data for last fiscal year period based on the sy-datum itself
like Output shou?ld be 10th feb 2012 to o th feb 2013..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
see two things you have to decide:
Please clarify.Based on these inputs code need to be amended,
Regards,
AL
Please check this code out:
Data:MM(2) type n,
fisc type bi0/oifiscper,
fisc1 type bi0/oifiscper,
zyear type /bi0/oicalyear,
zyear1 type /bi0/oicalyear.
WHEN 'V2'.---Cmod variable
IF i_step = 2.
CLEAR: l_s_range.
zyear = sy-datum(4) - 1.
zyear1 = sy-datum(4) - 2.
MM = sy-datum+4(2).
CONCATENATE zyear '0' MM INTO fisc.
CONCATENATE zyear1 '0' MM INTO fisc1.
l_s_range-low = fisc1.
l_s_range-high = fisc.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
EXIT.
ENDIF.
Hope this helps.
Regards,
AL
Hi Pallavi,
You can make use of FM RST_TOBJ_SHIFT in your customer exit variable.
WHEN 'ZPYTD'.
CALL FUNCTION 'RST_TOBJ_SHIFT'
EXPORTING
I_TIMNM = '0CALMONTH'
I_TIMVL = " Enter yout current cal month here in format 201402"
I_SHIFT = '24-'
I_FISCVARNT = "enter your fiscal year variant"
IMPORTING
E_TIMVL = l_s_range-low.
CALL FUNCTION 'RST_TOBJ_SHIFT'
EXPORTING
I_TIMNM = '0CALMONTH'
I_TIMVL = " Enter yout current cal month here in format 201402"
I_SHIFT = '12-'
I_FISCVARNT = "enter your fiscal year variant"
IMPORTING
E_TIMVL = l_s_range-high.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
Hope this helps.
Regards,
Satyam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I would prefer Anshu's solution to substracting 365 days logic. This logic fails when you come across Leap year.
most date calculations look simple however many solutions cover only 99% scenarios. 1% scenario will occur when u are totally unprepared.
Thanks and Regards,
A Prashant Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pallavi,
Can you write like below..
WHEN 'ZPYTD'.
CLEAR: date_py.
date_py = sy-datum - 365.
date_pz = date_py - 365.
l_s_range-low = date_pz.
l_s_range-high = date_py.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
Arivazhagan S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Data:MM(2) type n,
Month type /bi0/oicalmonth,
Month1 type /bi0/oicalmonth,
zyear type /bi0/oicalyear,
zyear1 type /bi0/oicalyear.
WHEN 'V2'.---Cmod variable
IF i_step = 2.
READ TABLE i_t_var_range INTO loc_var_range
WITH KEY vnam = 'V1'.--User input variable
CLEAR: l_s_range.
if sy-subrc = 0.
zyear = loc_var_range-low+0(4) - 1 .
zyear1 = loc_var_range-low+0(4) - 2 .
MM = loc_var_range-low+4(2).
CONCATENATE zyear MM INTO Month.
CONCATENATE zyear1 MM INTO Month1.
l_s_range-low = Month1.
l_s_range-high = Month.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
EXIT.
ENDIF.
EBDIF.
Hope this helps.
Regards,
AL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.