Skip to Content
0
Former Member
Sep 12, 2007 at 11:19 AM

How to get current fiscal year.

3214 Views

Hi Experts,

I am working on Asset Management.I need to get current fiscal year.

I have to enter fiscal year on selections screen which i have to validate that it should not be greater than current fiscal year.

For above i have used following code snippet but i have hard coded variant as 'MK'.

To get variant i was using function '/IBS/RB_FI_GET_FISCAL_YEAR_VAR' but in my selection screen we have to enter multiple company codes. if i will keep this function inside loop then it may give multiple variants.

How to resolve this ?

DATA : l_year(4) type c,

l_date TYPE sy-datum.

  • CALL FUNCTION '/IBS/RB_FI_GET_FISCAL_YEAR_VAR'

  • EXPORTING

  • i_company_code =

  • IMPORTING

  • E_FISCAL_YEAR_VARIANT =

  • EXCEPTIONS

  • COMPANY_CODE_NOT_FOUND = 1

  • OTHERS = 2.

*

l_date = sy-datum - 700.

l_date = l_date + 1.

IF sy-subrc EQ 0.

CALL FUNCTION 'GM_GET_FISCAL_YEAR'

EXPORTING

I_DATE = l_date

i_fyv = 'MK'

IMPORTING

E_FY = l_year

EXCEPTIONS

FISCAL_YEAR_DOES_NOT_EXIST = 1

NOT_DEFINED_FOR_DATE = 2

OTHERS = 3.

IF sy-subrc EQ 0.

IF s_gjahr-low GT l_year.

PRINT Error Message "Entered fiscal year should not be greater than current fiscal year".

ENDIF.

ENDIF.