Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM to get previous fiscal month/year and calendar month/year for a date.

Former Member
0 Kudos
5,987

Hi All,

I am having a requirement to extract some data based on either the previous fiscal month/year or the previous calendar month/year. There is no company code input to find the fiscal/calendar month/year.

At selection screen, user can select either fiscal or calendar selection.

Based on the selection, the data will be extracted.

For the system date, we need to calculate previous fiscal month/year or previous calendar month/year and populate the calculated data back to the selection-screen.

Can you one of you please suggest an FM to find previous fiscal month/year and previous calendar month/year.

Thanks in Advance,

Regards

Gowthami

11 REPLIES 11

Former Member
0 Kudos
738

Hi,

All the Function Modules are stored in the tbale 'TFTIT'.You can find the required FM there.

Thank U,

Jay....

Former Member
0 Kudos
738

Hi

use FM GET_CURRENT_YEAR Get the current fiscal year

Thanks

Former Member
0 Kudos
738

Hi Gowthami,

You can use following function module to calculate previous / next day or month or year.

call function '/SAPHT/DRM_CALC_DATE'

exporting

date = sy-datum

days =

months =

sign = '-'

years =

importing

calc_date = .

Here, you can give '-' to sign, if you want previous day / month / year.

Here, you can give '+' to sign, if you want next day / month / year.

And depending upon your requirement, you can pass suitable value to days / month / year.

e.g. To calcualte last month,

call function '/SAPHT/DRM_CALC_DATE'

exporting

date = sy-datum

days =

months = 1

sign = '-'

years =

importing

calc_date = wv_prev_month.

so it will give '23-01-2008' . Then convert it in the required format as per your requirement using string function concatenate.

Hope this help you.

Regards,

Anil

Former Member
0 Kudos
738

Hi,

You can use this FM

CALL FUNCTION 'CCM_GO_BACK_MONTHS'

EXPORTING

currdate = lv_date

backmonths = 1

IMPORTING

newdate = lv_new_date.

regards,

Lokesh

Former Member
0 Kudos
738

Hi,

Try this FM 'GET_CURRENT_YEAR'.

Regards,

Jyothi CH.

Former Member
0 Kudos
738

Hi,

Try using FMs

GM_GET_FISCAL_YEAR

RP_CALC_DATE_IN_INTERVAL

Hope it helps...

0 Kudos
738

The FM 'GM_GET_FISCAL_YEAR' gives only the fiscal year but not the fiscal month.

However, the FM 'FTI_FISCAL_YEAR_MONTH_GET' gives both the fiscal year and fiscal month, but here we need to pass Company code which is not input in my requriment.

Can you please help me getting an FM that gives me both fiscal year and month by input only system date?

Thanks & Regards

Gowthami

Former Member
0 Kudos
738

Hi Gowthami,

If you developing for somthing, i guess the company code would remain the same throughout the organisation.

Any ways,

COPCA_PERIOD_GJAHR_GET - company code and current date required

FI_PERIOD_DETERMINE - company code not required, but you need to input the fiscal year variant alongwith the current date.

Again the Fiscal year variant is company code dependent, which you can get from table T001, field PERIV

Edited by: Azeem Ahmed Matte on Feb 24, 2009 6:44 AM

0 Kudos
738

Hi Azeem,

Can you please tell me which of the parameters in the FM 'FI_PERIOD_DETERMINE' represents the fiscal variant?

Thanks much,

Regards

Gowthami

0 Kudos
738

Thanks a lot Azeem.

Got it.

Former Member
0 Kudos
738

Hi Gowthami,

I guess your question got answered