Skip to Content
avatar image
Former Member

Need FM to find starting n ending dates from a Posting period and Fiscal yr

Hi Friends,

I need a function Module wherein

The available Inputs are

Fiscal Year :eg 2007

Period :eg 04

Fiscal Year Variant :eg 'ZB' ie from December to November of a year

For the set of inputs (2007, 04, ZB) I need the <b>Starting and Ending dates of the period</b> ie 01.03.2007 and 31.03.2007.

Points would be rewarded for helpful answers.

Thanks and Regards,

Atin

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Aug 16, 2007 at 06:01 PM

    The starting date of the period will always be the 1st.

    To get the end date, call FM <b>LAST_DAY_OF_MONTHS</b>

    Example Code:

    DATA: start_date TYPE sy-datum,
          end_date   TYPE sy-datum.
    
    DATA: input_fiscal_year(4) TYPE c VALUE '2007',
          input_period(2)      TYPE c VALUE '08'.
    
    start_date+0(4) = input_fiscal_year.
    start_date+4(2) = input_period.
    start_date+6(2) = '01'.
    
    CALL FUNCTION 'LAST_DAY_OF_MONTHS'
      EXPORTING
        day_in            = start_date
      IMPORTING
        last_day_of_month = end_date.
    
    WRITE: / start_date.
    WRITE: / end_date.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2007 at 06:41 PM

    You can use these 2 FMs to get the start and end date

    FIRST_DAY_IN_PERIOD_GET

    LAST_DAY_IN_PERIOD_GET

    For Fisrt and last day of the fiscal year use

    FIRST_AND_LAST_DAY_IN_YEAR_GET

    Reward Points if helpful

    Add comment
    10|10000 characters needed characters exceeded