on 01-15-2008 2:26 PM
I am trying to use a variable in a macro on the demand planning grid. The logic needs to go as follows.
Initialize a user defined variable and set to 0 at the default event.
If a change is made to certain rows, set the variable to 1 at the default event.
Then if the variable is 1, add the rows together at the default event.
I have all of it written except for the variable part. I looked in the SAP help and could not find what I needed. I also searched the forum with no luck. I am looking for what the syntax needs to be and what elements are needed to accomplish this.
Can someone please help?
I added the space and it lets me activate the macro.
Here is how I am setting the variable:
If Data Input for Total Demand
IF
Data Input?
ROW_VALUES_CHANGED(
Cell: Base Forecast ( P 07.2005 )
) = 1
OR
ROW_VALUES_CHANGED(
Cell: Forecast Adjustments ( P 07.2005 )
) = 1
OR
ROW_VALUES_CHANGED(
Cell: Promo Forecast ( P 07.2005 )
) = 1
Set Demand Change Variable to 1 : ( 1 Iterations : P 07.2008; P 07.2008 )
Set Demand Change Variable to 1
LAYOUTVARIABLE_SET( 'CHANGE' ; 1 )
ENDIF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes!!! Thank you for your prompt, helpful, and knowledgeable response!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to use those variables and I am getting a funny error when I try to save the macro.
Error:
"The field "LAYOUTVAR_VALUE(" is unknown, but there is a field with the similar
name "CON_LAYOUTVAR_VALUE". "CON_LAYOUTVAR_VALUE".
Macro(s) Was/Were Not Generated, Macro Book Was Not Saved"
However when I try to use the variable they suggest it does not exist either and I get the same mesage asking me to use the same variable they are suggesting.
Here is the macro I am trying to create. I have the portion of the macro for the variable initialization and set created successfully.
This is the part with the trouble. I am trying to say, if the variable equals 1 to execute the calculation. Do you know what I could be doing wrong?
Calculate Total Demand New
Condition (IF)
(Control Statement) The Demand Change Variable equals 1 (Operator/Function) LAYOUTVAR_VALUE('CHANGE')
(Operator/Fucntion) = 1
(Step) Calculate Total Demand : ( 24 Iterations : P 07.2008; P 06.2010 )
Row: TOTAL DEMAND ( Frm P 07.2008 ) =
Row: Base Forecast ( Frm P 07.2008 )
+
Row: Forecast Adjustments ( Frm P 07.2008 )
+
Row: Promo Forecast ( Frm P 07.2008 )
(Condition) ENDIF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Stacey.
Try the function:
LAYOUTVARIABLE_SET() to set the variable
syntax=( 'name of variable' ; value of variable )
and then:
LAYOUTVAR_VALUE() to return value or LAYOUTVARIABLE() to return characters
syntax=( 'name of variable').
Would recommend that you look at the example macros in the macro workbench, book: 9AEXAMPLES.
Hope this helps.
Mark.
Edited by: percx on Jan 15, 2008 3:34 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.