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: 

Fiscal Year to date

Former Member
0 Kudos

I would like, your help writing a code, to:

Determine ZFISCYTD: Number of Calendar Days from the First Day of Current fiscal period to Today Date (including weekend days)

If needed, I already have:

Variable 0P_FPER: return either Previous Business Day or Last day of the entered period

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Use the following function module to get the first day of the period. Then subtract from today.



data: 
      period type t009b-poper,
      year   type t009b-bdatj.
      

data: number_of_days type i.
data: first_day_of_period type sy-datum.


  year = sy-datum+0(4).  " Year
  period = '01'.     " Fiscal Period

  call function 'FIRST_DAY_IN_PERIOD_GET'
       exporting
            i_gjahr  = year
            i_monmit = 00
            i_periv  = 'YT'    "Variant
            i_poper  = period
       importing
            E_DATE  = first_day_of_period.


number_of_days = sy-datum - first_day_of_period.


Welcome to SDN!! Please reward points for helpful answers and mark your posts as solved when solved. Thanks.

Regards,

Rich Heilman

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Use the following function module to get the first day of the period. Then subtract from today.



data: 
      period type t009b-poper,
      year   type t009b-bdatj.
      

data: number_of_days type i.
data: first_day_of_period type sy-datum.


  year = sy-datum+0(4).  " Year
  period = '01'.     " Fiscal Period

  call function 'FIRST_DAY_IN_PERIOD_GET'
       exporting
            i_gjahr  = year
            i_monmit = 00
            i_periv  = 'YT'    "Variant
            i_poper  = period
       importing
            E_DATE  = first_day_of_period.


number_of_days = sy-datum - first_day_of_period.


Welcome to SDN!! Please reward points for helpful answers and mark your posts as solved when solved. Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi

Use FM FIRST_DAY_IN_PERIOD_GET to get first day in period, Difference betwn the FM date and current date would be what you need.

Regards

Kalpana