cancel
Showing results for 
Search instead for 
Did you mean: 

Macro Help

0 Kudos

Hi All,

I need help in our Macro Logic.

We running a Macro which should basically delete the volumes of Sales Forecast in Current Months one specific Bucket.

We are using Gregorian Calendar in which one our data view has Buckets with respect to Split Weeks where a week constitute some days in current month and next months days.

Our current logic is to delete the data in Sales Forecast which is available in Split Week of Current Month if my current week is a Split Week of current Month.

I was able to get write the logic to check whether the current iteration selection is Current month but I am facing problem determining the Split Week of Current Month. We separate the Split Week by A and B. Example Week 31 is a Split Week, so this get separated by WK 31 A July Dates and WK 31 B August Days.

I wrote a logic to check whether current iteration is Split Week. Logic looks like below snapshot:


What I am trying to check here is that, Current Iteration Sale Forecast Begin Date of Bucket I am getting and checking the WEEKDAY it falls in and similar for End Date of Bucket. If its Split Week B then it cant have Weekday as 1 and it should weekday as 7 on end date of the Bucket for Split Week B. If these condition satisfy then delete the Sales Forecast of the current week. I tried the above logic in one If Condition with AND operator but I am unable to yield the results.

Could anyone help me with respect to any other logic to check whether selected iteration is a Split week of B Type? Kindly correct if my above logic is wrong and could some provide proper way to retrieve the above logic.

Hope these details are enough. Kindly revert back if you have any question or need more information.

Thanks,

Bhaskar

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member187488
Active Contributor
0 Kudos

Hello Bhaskar, Not sure whether my understanding is correct, but  I think only checking "bucket start date <> Monday" is enough to judge whether a bucket is a split week B type ... no need to judge the bucket end date ... And similarly, "bucket end date <> Sunday" is a criterion to judge split week A type ...

0 Kudos

This message was moderated.

0 Kudos

Hello Ada,

Thanks a lot your response and sorry on the delay response. Yes, I need to find whether the bucket start date is Monday and I need to find whether the bucket end date is Sunday. Reason being i need both is that as you could see the example of July 2013 month. there is no A and B Split Weeks. This my macro has to identify. My condition is to check whether my start day is not monday but end date of the bucket is Sunday. This would ensure that the week is B Type.

Could you help determine the above requirement? Or is there any other way we can determine the B Week type of current month

Thanks,

Best Regards,

Bhaskar

former_member187488
Active Contributor
0 Kudos

Hello Bhaskar, It's OK if you insists on your logic ... does your macro work fine? Or you have encountered some problem?  And are you using fiscal year variant to acheive the split week in the data view? Maybe you can share how your data view look like.

However, I still think only checkin bucket start <> Monday is enough, since I don't think there is a bucket satisfies both 'bucket start <> Monday' and 'bucket end <> Sunday', unless you have special setting using fiscal year variant.

Best Regards,

Ada

0 Kudos

Hi Ada,

With my above logic snapshot, it is not working correctly. Reason being when we use the BUCKET_EDATE or BUCKET_BDATE it returns the date as a numeric number and this numeric number cant determine the WEEKDAY as Weekday Function we need to have the date not the Numeric Number.


If you look into the above the view is the Data View. Our expectation is to delete the volumes in Sales Forecast in the Current Month Week B if exists. If you consider the July Month 2013, there is no Week B and Week A Split in the end. In this case we need to have to check Start Day and End Day for the Bucket and making sure we delete the volumes in Week B not A or whole week data.

Could you help me with logic to get Weekday details of Bucket Begin Date and similarly End Date Weekday?

Thanks,

Best Regards,

Bhaskar

former_member187488
Active Contributor
0 Kudos

Hello,

You cam make use of DATE() macro function. Refer to the below link: http://help.sap.com/saphelp_scm70/helpdata/EN/1d/310eb0d0ee11d4b2e40050da385632/content.htm?frameset...

Another idea is, you can try macro function BUCKET_DESCRIPTION() to get the column header text, and check if it ends with 'B'. However I could not find a function to get the last character of string, so maybe BADI macro is needed here?.

Best Regards,

Ada