on 11-28-2012 8:44 AM
Hi,
The requirement which I want to implement is if Sales Orders are greater than zero at location level, then value of Forecast should be equal to Sales Orders. For this I wrote the macro which runs at location level to set the value of flag to 1 if sales orders is greater than zero else 0 using LAYOUTVARIABLE_SET.
Now I am referncing this value of flag(using LAYOUTVAR_VALUE) in other macro. However this macro is running at lowest level i.e. at location,product,country etc. and for some reason it is not getting the value of flag set in other macro.
Please let me know how to make it work or is there any other logic to implement it.
Thanks,
Alok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
are you running this two macros together (in a collective macro) or one after the other? Also, are you running them as a background job or interactively?
regards,
J.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, then the answer to your problem is that the variable is destroyed after execution of the first background job.
If you are running in SNP, and want to keep both processes separated, you can use TS_SET and TS_GET to store data persistently in an internal table. Use your first macro to store the value for your location, then read it in the second macro. In this case, you'll need a third macro to reset the table using TS_SET again and zeroing wathever you wrote in the first place.
If you are in a DP context and can spare a key figure (even an unused cell would do). Write say 99999 at the aggregate level to flag in the first macro and let it dissagregate through your lower levels. In this case, the second macro will find something <>0 and you could easyliy work from there. I suggest you try this second possibility.
thanks,
J.
Hi James,
Yes its in DP context. But I am not sure how exactly to implement your suggestion.
First macro is currently written as below:
IF
Sales Order > 0
then Set
LAYOUTVARIABLE_SET( 'FLAG' ; 1)
else Set
LAYOUTVARIABLE_SET( 'FLAG' ; 0)
END IF
And in the second macro condition is checked as
IF LAYOUTVAR_VALUE( ' FLAG' ) = 1
then
Forecast= Sales Order
END IF
Can you please suggest how to modify them to make it work.
Thanks
Hi,
chose a key figure you can spare.
In the first macro, do the following:
if [salesorder>0] then [cell (or row element) = 99999] else [cell (or row element) =0] endif.
These values will dissagregate to lower level and will be stored in liveCache, accesible for any other macro you run at any other time.
In the second macro, replace IF flag = 1 with:
if [cell (or row element) <> 0] then [fcst = sales order] endif.
if you find a value <>0, it means that the higher level had sales order >0.
regards,
J.
1) Are you sure you are executing your second macro at the correrct aggregation level when executed in background? Check by selecting log in the process (and read the cvcs accessed by system) or check number of entries in the selection. If you want to access your detailed level, you must select them in the process.
2) Else, is your "spare ratio" in liveCache (does it allow to save data)? For instance; if you don't put the macro as default,start, etc... (no automatic execution), execute macro 1 interactively, save, exit and go back, is the ratio populated?
Of course, if the ratio cannot save data (2), (1) will not work either.
regards,
J.
User | Count |
---|---|
15 | |
4 | |
3 | |
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.