cancel
Showing results for 
Search instead for 
Did you mean: 

FIRST_DAY_IN_PERIOD_GET fm giving 13 months in a fiscal year instead of 12.

Rana1131
Explorer
0 Kudos

Iam using this fm to get data of a fiscal year. If i enter posting period as 8 ie, November and Year as 2023. it should get data from 1st Dec 2022  to 30th Nov 2023 ie, 12 months. Instead of this it is fetching data from 1st Nov 2022 to 30th Nov 2023 ie, 13 months. kindly help. below is the code. it is giving e_date = 1st Nov 2022 , instead of 1st Dec 2022.
* Get Billing Date
*   Posting Date YYYY
    DATA lv_gjahr TYPE bdatj.

*   Posting Period
    DATA lv_poper TYPE poper.

    lv_gjahr im_gjahr 1" Previous Year of Input

*   Date of First Day determined for Period and Fiscal Year
    CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
      EXPORTING
        i_gjahr        lv_gjahr
        i_periv        'V3' " April - March, 4 Special Periods
        i_poper        lv_poper
      IMPORTING
        e_date         gv_ysd
      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.

    IF im_poper > 2.
      lv_poper im_poper 2" Last 2 Months of Input Period

    ELSE.
      lv_poper im_poper.
    ENDIF.
    lv_gjahr im_gjahr.

*   Date of First Day determined for Period and Fiscal Year
    CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
      EXPORTING
        i_gjahr        lv_gjahr
        i_periv        'V3' " April - March, 4 Special Periods
        i_poper        lv_poper
      IMPORTING
        e_date         gv_qsd
      EXCEPTIONS
        input_false    1
        t009_notfound  2
        t009b_notfound 3
        OTHERS         4.
    IF sy-subrc <> 0.

Sandra_Rossi
Active Contributor
0 Kudos
It depends on your customizing. The code is very short, you should be able to debug the function module quickly to understand which customizing affects the calculation.

Accepted Solutions (0)

Answers (0)