cancel
Showing results for 
Search instead for 
Did you mean: 

Macro to calculate remaining days of the month

Former Member
0 Kudos

hi Folks,

I have a monthly view & a weekly view & then weeks supply (WOS) are calculated in both views the same way ( only difference is the buckets). The WOS are the same in both views during the first week of the month, they are different from the second week (till the last week) of the month.

The reason behind it is because of the work days. The Monthly bucket has 30 days as work days for April, which is right for the first week of April. But for the second week of April expect it to be 23 instead of 30.

Is there a way to calculate the remaining days for the month using the standard SAP functions.

The following is the macro I am using to calculate the calendar days for every bucket ( the buckets are monthly) & then updating the Key figure Calendar Days [DB].

Calendar Days in Bucket : ( 36 Iterations :APR-2013;MAR-2016 )

     Row: Calendar Days [DB] ( Frm APR-2013 ) =

          CALENDAR_WDAYS( 'Z7DAYCAL'

          ;

          WEEK( TODAY )

          ;

         BUCKET_EDATE(

          Row: Forecast ( Frm APR-2013 )

          )

          )

This macro returns the number of days for the month & not the number of remaining days for the month.

Any kind of help will be appreciated.

Thanks,

Vasu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi V, why not use a separate variable to subtract the Bucket_Edate value, from Today's date. Then you'll have the remaining days captured.

The variable value will then decrease as you progress through the time buckets.

When the end-of-month splits the time bucket, you will have to decide how to manage that with your Weeks of supply calculation.

Regards,

Roger Weinberg

Answers (0)