Application Development and Automation 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: 
Read only

Fiscal year

Former Member
0 Likes
2,230

Hi,

My requirement is when the fiscal period and fiscal year is given in the selection screen,then in the o/p the dates corresponding to the periods given in the selection screen has to be displayed.for our customer the fiscal year starts from october and ends at september.

Month 1 in the year 2008 corresponds to month 10 in 2007.

month 2 in the year 2008 corresponds to month 11 in 2007 and so on.

In the o/p it should be displayed as

2008-1 2008-2 2008-3............

2008-1 should have dates in october 2007

2008-2 should have dates in november 2007.

How can I convert the periods given in the selection screen to dates and display them as shown above in the o/p.

Can anyone suggest a proper solution for this?

Regards,

Hema

Hi,

My requirement is when the fiscal period and fiscal year is given in the selection screen,then in the o/p the dates corresponding to the periods given in the selection screen has to be displayed.for our customer the fiscal year starts from october and ends at september.

Month 1 in the year 2008 corresponds to month 10 in 2007.

month 2 in the year 2008 corresponds to month 11 in 2007 and so on.

In the o/p it should be displayed as

2008-1 2008-2 2008-3............

2008-1 should have dates in october 2007

2008-2 should have dates in november 2007.

How can I convert the periods given in the selection screen to dates and display them as shown above in the o/p.

Can anyone suggest a proper solution for this?

Regards,

Hema

4 REPLIES 4
Read only

Former Member
0 Likes
1,480

Hi,

GJAHR & MONAT are the fields you will find in SAP database tables.Data fetch & processing are based on the format it is stored in DB. But in your display report, have to hard code or create a custom table for your format of Oct = 01, Nov 02 etc...

If the hint is usefulu2026 Say thanks by rewardu2026.

Regards,

Prabhu Rajesh

Read only

Former Member
0 Likes
1,480

hi Supriya,

this might help.

v CONVERSION_EXIT_PDATE_INPUT Conversion Exit for Domain GBDAT: DD/MM/YYYY -> YYYYMMDD

v CONVERSION_EXIT_IDATE_INPUT External date INPUT conversion exit (e.g. 01JAN1994)

v CONVERSION_EXIT_SDATE_INPUT External date (e.g. 01.JAN.1994) INPUT conversion exit

v CONVERT_DATE_INPUT Conversion of a date from external to internal format

v CONVERSION_EXIT_PDATE_OUTPUT Conversion Exit for Domain GBDAT: YYYYMMDD -> DD/MM/YYYY

v CONVERSION_EXIT_IDATE_OUTPUT External date OUTPUT conversion exit (e.g. 01JAN1994)

v CONVERSION_EXIT_LDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD)

v CONVERSION_EXIT_SDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD)

v CALCULATE_DATE : Calculates the future date based on the input .

v DATE_TO_DAY : Returns the Day for the entered date.

v DATE_COMPUTE_DAY : Returns weekday for a date

v DATE_GET_WEEK : Returns week for a date

v RP_CALC_DATE_IN_INTERVAL : Add days / months to a date

v DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified

v MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.

v END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.

v HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.

v FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.

v MONTH_NAMES_GET : Get the names of the month

v WEEK_GET_FIRST_DAY : Get the first day of the week..

Amit

Read only

Former Member
0 Likes
1,480

Hello Hema,

The function module DATE_TO_PERIOD_CONVERT can be used to get the current period by passing the current date. This function module need the following import parameters

I_DATE Current Date

I_MONMIT First day of the second half of the month

PERIV Fiscal year variant

I_DATE in this field you can pass todays date or sy-datum.

I_MONMIT in this field you can pass '00'

PERIV in this filed you can pass the FISCAL YEAR for a list of Fiscal years run transaction OB37

DATA: D_PERIOD T009B-POPER, " determined posting period

D_Year T009B-BDATJ. " determined fiscal year

CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
     EXPORTING
          I_DATE         = SY-DATUM
          I_MONMIT   = 00
          I_PERIV        = 'K4'
     IMPORTING
          E_BUPER        = D_PERIOD
          E_GJAHR        = D_YEAR
     EXCEPTIONS
          INPUT_FALSE          = 1
          T009_NOTFOUND  = 2
          T009B_NOTFOUND = 3
          OTHERS                  = 4.

PERIOD_DAY_DETERMINE

The above mentioned function module will determine the first of the the Fiscal Year. If you want to know the first day of the Fiscal year for a Company, then you can use this function module. While trying this function module for company codes of different countries.

REPORT YH_PERIODDAYDETERMINE .


Data: d_gjahr     like BKPF-GJAHR,   "Fiscal year
      d_monat     like BKPF-MONAT,   "Posting period
      d_periv     like T001-PERIV,   "Period version
      d_fday      like BKPF-BUDAT,   "First period day
      d_lday      like BKPF-BUDAT,   "Last period day
      d_SPERIOD   like BKPF-BSTAT.   "Special period indicator


    Move: '2008' to   d_gjahr,
          '01'   to   d_monat,
          'K4'   to   d_periv.

CALL FUNCTION 'PERIOD_DAY_DETERMINE'
  EXPORTING
    I_GJAHR                    = d_gjahr
    I_MONAT                    = d_monat
    I_PERIV                    = d_periv
  IMPORTING
    E_FDAY                     = d_fday
    E_LDAY                     = d_lday
    E_SPERIOD                  = d_SPERIOD
  EXCEPTIONS
    ERROR_PERIOD               = 1
    ERROR_PERIOD_VERSION       = 2
    FIRSTDAY_NOT_DEFINED       = 3
    PERIOD_NOT_DEFINED         = 4
    YEAR_INVALID               = 5
    OTHERS                     = 6
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Write:/ 'First Day Of the Fiscal Year =',d_fday.

Output of the above program is as follows.

Period Day Determine

First Day Of the Fiscal Year = 01/01/2008

Last Day Of the first period Fiscal Year = 01/31/2008

Change the Fiscal Year Variant to some other country and see the result. In my system I got the following result.

Period Day Determine

First Day Of the Fiscal Year = 04/01/2008

Last Day Of the first period Fiscal Year = 04/30/2008

Hope it helps you

Regards

Indu.

Read only

Former Member
0 Likes
1,480

Try with the below function module G_POSTING_DATE_OF_PERIOD_GET.

Regards,

Kiran BObbala