cancel
Showing results for 
Search instead for 
Did you mean: 

Identify the current week using macro

former_member343632
Participant
0 Kudos

Hi all,

I have to write a macro to do some calculation if we are in current week and for future weeks some different calculation.

My question is how to determine the current week.

Please help me on this.

Prabhat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Prabhat,

Define a step loop with a single iteration user defined period for current week and mark the automatic adjustment.

regards,

Edgar

Former Member
0 Kudos

I mean, you'll have two loops, one with the calculation for this week and another for the future periods.

jagannadhb
Active Participant
0 Kudos

Adding to the above, make sure your step properties include User Defined and 1 Iteration, for the current week calculations.

Regards

JB

former_member343632
Participant
0 Kudos

Hi Edgar,

Thank you for your response.

What I am thinking is that instead of having 2 loops, can we have one loop only and put the calculation in IF-ELSE-ENDIF format.

Like -

IF

the week is current then

do X

ELSE

do Y

ENDIF

former_member343632
Participant
0 Kudos

Hi Jaga,

Thank you for your response.

What I am thinking is that instead of having 2 loops, can we have one loop only and put the calculation in IF-ELSE-ENDIF format.

Like -

IF

the week is current then

do X

ELSE

do Y

ENDIF

Regards,

Prabhat

Former Member
0 Kudos

If I'm not mistaken, Prabhat, it's:

WEEK ( TODAY ) = WEEK( BUCKET_BDATE() )

You can check other options in:

Date Functions - Planning Area Administration - SAP Library

regards,

Edgar

jagannadhb
Active Participant
0 Kudos

Dear Prabhat,

As Edgar has suggested, you can use date functions as follows:

Please let me know if it meets your requirement.

Regards,

JB

Answers (0)