2006 Nov 15 8:20 PM
Hi,
I would like to know if there is any function module to convert calendar month and year to Fiscal Period.
Example: 07 month and 2005 year of calender would be Fiscal period 001 / FY05 (actually July)
Here is my below code & problem:-
Please let me know how do I do it for any date that a user enters & convert that to respective Fiscal Period.
Points will be rewarded.
CODE: There is some issue with this one.
w_date='20060202' (I need to convert whatever user enters & not hard code it this way)
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = w_date
I_MONMIT = 00
I_PERIV = 'S1' (Fiscal period Variant)
IMPORTING
E_BUPER = w_period
E_GJAHR = w_year
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
Thanks.
2006 Nov 15 8:26 PM
2006 Nov 15 8:37 PM
Make sure w_date is declared like sy-datum:
PARAMETERS: w_date LIKE sy-datum.
DATA: w_period LIKE t009b-poper,
w_year LIKE t009b-bdatj.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = w_date
i_monmit = 00
i_periv = 'S1'
IMPORTING
e_buper = w_period
e_gjahr = w_year
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
Rob
2006 Nov 15 8:44 PM
Rob,
If I give w_date LIKE sy-datum, wudn't it take the system date & convert that to the reaspective period. Correct me if I'm wrong. This is what I need to do: No matter what date the user enters in the report, it needs to return the fiscal period for that date.
Also, will my code return the value or not?
Thanks in advance.
2006 Nov 15 8:50 PM
It just creates a parameter with the same attributes as SY-DATUM. The user is forced to enter it in the correct format. I tested the code I posted and it returns the result I expect. Why don't you just try it out?
Rob
2006 Nov 15 9:13 PM