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: 

I need a FM that finds a month

Former Member
0 Kudos

Hello all

I need a FM that finds the month and year for a given fiscal period.

for example, in my company I know that fiscal period 03/2005 is actually december 2004.

does anybody knows if exist such a FM?

thanks in advance.

5 REPLIES 5

Former Member
0 Kudos

Yes, use FMs FIRST_DAY_IN_PERIOD_GET, LAST_DAY_IN_PERIOD_GET

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

What I did was wrote a function module to do this for me.



FUNCTION Z_GET_FS_PD_DATES.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(I_GJAHR) LIKE  T009B-BDATJ
*"     REFERENCE(I_MONMIT) LIKE  GJVAR-MONMIT DEFAULT 00
*"     REFERENCE(I_PERIV) LIKE  T009B-PERIV
*"     REFERENCE(I_POPER) LIKE  T009B-POPER
*"  EXPORTING
*"     REFERENCE(S_DATE) LIKE  SY-DATUM
*"     REFERENCE(E_DATE) LIKE  SY-DATUM
*"----------------------------------------------------------------------

CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
  EXPORTING
    I_GJAHR              = I_GJAHR
    I_MONMIT             = 00
    I_PERIV              = I_PERIV
    I_POPER              = I_POPER
 IMPORTING
    E_DATE               = S_DATE
* EXCEPTIONS
*   INPUT_FALSE          = 1
*   T009_NOTFOUND        = 2
*   T009B_NOTFOUND       = 3
*   OTHERS               = 4
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
  EXPORTING
    I_GJAHR              = I_GJAHR
    I_MONMIT             = 00
    I_PERIV              = I_PERIV
    I_POPER              = I_POPER
 IMPORTING
    E_DATE               = E_DATE
* EXCEPTIONS
*   INPUT_FALSE          = 1
*   T009_NOTFOUND        = 2
*   T009B_NOTFOUND       = 3
*   OTHERS               = 4
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ENDFUNCTION.


Regards,

Rich HEilman

Former Member
0 Kudos

Hi,

Try FM FTI_FISCAL_YEAR_MONTH_GET.

Hope it helps.

Mireia

andreas_mann3
Active Contributor
0 Kudos

try fm FTI_FISCAL_YEAR_MONTH_GET

Andreas

0 Kudos

How did you solved your problem. Were any answers helpful?

Regards,

Rich Heilman