2008 Jun 19 11:39 AM
Hi,
we need to convert the fiscal period into months and dates.A fiscal period of 1 in 2008 would correspond to the month of Oct 2007 and a period of 2 in 2008 would be from Oct 28 to Nov 28.
Is there any calculation to convert the fiscal period into date?
2008 Jun 19 11:43 AM
Check the FMs
FI_PERIOD_DETERMINE
FIRST_DAY_IN_PERIOD_GET
FIRST_AND_LAST_DAY_IN_YEAR_GET
LAST_DAY_IN_PERIOD_GET
Thanks,
Rajinikanth
2008 Jun 19 11:51 AM
hiii
use following FM
'DATE_TO_PERIOD_CONVERT'
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum " today
i_periv = 'FY'
IMPORTING
e_buper = w_period " period
e_gjahr = w_year " year
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
CONCATENATE w_year w_period INTO w_per_cur.
<removed_by_moderator>
thx
twinkal
Edited by: Julius Bussche on Aug 13, 2008 5:06 PM
2008 Jun 19 12:01 PM
Hi twinkal,
I want to convert a period to date but not date to period.Could you please suggest a function module for this?
2008 Jun 19 12:03 PM
2008 Jun 19 12:11 PM
hiii hema,
i have not used following FM.but check if it fulfills your requirement.
CONVERT_DATE_BY_PERIOD_INPUT
CONVERT_DATE_BY_PERIOD_OUTPUT
regards
twinkal
2008 Aug 13 10:36 AM
2008 Jun 19 12:11 PM
Hi,
You can get the date from the period using FIRST_DAY_IN_PERIOD_GET and LAST_DAY_IN_PERIOD_GET.
for this you need to pass the fiscal year ,Fiscal year varaint and period.
You can get the Fiscal year varaint using FM
CCODE_GET_FISCAL_YEAR_VARIANT, for this you need to pass company code for which you are looking.
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = g_year (Fiscal year)
i_periv = g_periv (Fiscal year varaint)
i_poper = g_month (Period)
IMPORTING
e_date = wa_periods-stdat
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
Thanks,
Rajinikanth
2008 Aug 13 10:42 AM
2008 Aug 13 11:18 AM
Just check the below code,may be it can give you some lead for your requirement.In the first field enter the period and in the next enter the year.The report will fetch you the begin and end dates of the current year and the previous year.
Suppose if you give period as 4 and year as 2007 it gets you the begin and end dates of 2008 as well as 2007 period-wise
REPORT ZPERIOD .
data: it_cperiod type table of range_prds with header line,
it_pperiod type table of range_prds with header line,
t_year like t549q-pabrj.
ranges: r_cperiod for sy-datum,
r_pperiod for sy-datum.
selection-screen begin of line.
selection-screen comment (30) text-002.
selection-screen position 33.
parameters: p_cmonth like t549q-pabrp obligatory,
p_cyear like t549q-pabrj obligatory.
selection-screen end of line.
* Get the Begin and End Date of the Current Month
at selection-screen.
CALL FUNCTION 'BUILD_PERIOD_TABLE'
EXPORTING
YEAR = p_cyear
TABLES
PERIOD_TABLE = it_cperiod.
read table it_cperiod with key per_id = p_cmonth.
refresh r_cperiod.
r_cperiod-sign = 'I'.
r_cperiod-option = 'BT'.
r_cperiod-low = it_cperiod-begda.
r_cperiod-high = it_cperiod-endda.
append r_cperiod.
* Get the Begin and End Date of Previous Month
t_year = p_cyear.
t_year = p_cyear - 1.
CALL FUNCTION 'BUILD_PERIOD_TABLE'
EXPORTING
YEAR = t_year
TABLES
PERIOD_TABLE = it_pperiod.
read table it_pperiod with key per_id = p_cmonth.
refresh r_pperiod.
r_pperiod-sign = 'I'.
r_pperiod-option = 'BT'.
r_pperiod-low = it_pperiod-begda.
r_pperiod-high = it_pperiod-endda.
append r_pperiod.
start-of-selection.
write:/'Current Period'.
loop at it_cperiod.
write:/ it_cperiod-per_id,
it_cperiod-period,
it_cperiod-begda,
it_cperiod-endda.
endloop.
write:/'Previous Period'.
loop at it_pperiod.
write:/ it_pperiod-per_id,
it_pperiod-period,
it_pperiod-begda,
it_pperiod-endda.
endloop.
K.Kiran.