cancel
Showing results for 
Search instead for 
Did you mean: 

Copy macro with condition

Former Member
0 Kudos

Hi APO experts,

beeing abaper I have been involved in the project of SCM-APO Demand planning

implementation in our company. I would like to also get familiar with APO macros

in the MacroBuilder and to help with solution of one issue which appeared after

go-live. Mostly because the aplication team wants to do this via user-exits, BAdIs

or somehting and I believe this should be easily possible by Macro functions... but

I don't know how

I would like to design simple planning area macro which runs weekly and would copy key figure

'Fcst(FINAL)' into key figure 'Fcst(last month)' from W50.2011 to W50.2013 (user-defined range).

But this copying should only be done into buckets which lies completelly in next month from today.

So let's say, the current datum is 7th Feb 2012, W06.2012. In this day the macro should copy

buckets from W10.2012 since the 10th week is first week completelly in March.

I tried something like this:


	[step] Copy Data: (105 Iterations: W50.2011; W50.2013)
	IF
	[cond] Check if week is fully in the next month
		MONTH_BDATE( MONTH( TODAY ) + 1 ) <= BUCKET_BDATE(
		Row: Fcst(FINAL) (Frm W50.2011)
		)
	Row:Fcst(Last Month) (Frm W50.2011) =
		Row: Fcst(FINAL)(Frm W50.2011)
	ENDIF

But it seems it doesn't work since the BUCKET_BDATE function doesn't return any datum of

the bucket in the argument. How do I get the datum which correspons with the current bucket

iteration?

Accepted Solutions (1)

Accepted Solutions (1)

former_member187488
Active Contributor
0 Kudos

Hello,

In order to make the macro functions such as BUCKET_BDATE work, the parameter of it (Row: Fcst(FINAL), in your case) should be set as "Datasource -> Column attribute". You can double click on the parameter (Row: Fcst(FINAL)), and in the popup screen, make the above setting in the "datasource" area.

Best Regards,

Ada

Former Member
0 Kudos

Thanks Ada for help,

yes this was probably my problem. At the end of the day I have made my macro as follows:


[Step] Copy Data: (104 Iterations: W 51.2011; W50.2013)
	IF

	[cond] Bucket lies completelly in next month
	BUCKET_BDATE(
	Row: Fcst(FINAL) ( Frm W51.2011 )
	) > MONTH_EDATE( TODAY )

	Row: Fcst(Last Month) (Frm W51.2011 ) =
		Row: Fcst(FINAL) (Frm W51.2011 )

	ENDIF

and it seems to be what I need. Point awarded. Thanks Zdenek

Answers (1)

Answers (1)

former_member209769
Active Contributor
0 Kudos

Hi Zdenek,

Sorry, your requirement is much simpler than what I thought. Taking out my comments to avoid confusion.

Thanks - Pawan

Edited by: Pawan Pathak on Dec 20, 2011 10:50 AM