cancel
Showing results for 
Search instead for 
Did you mean: 

SNP: Macro Not Working

Former Member
0 Kudos

Hello All,

I have created a macro to copy stock on hand ( Projected) to Z Key Figure in SNP Planning Book. While the macro works fine in interactive planning, it is not working properly through background job. It does not copy any value from Stock on hand ( Projected) and the Z Key figure holds Zero Value.

When i run my job yesterday for the very first, i got the below spool message

Macro Stock On Hand Copy has been executed

Data saved successfull

History cannot be entered in book, you cannot save data

since the Z Key figure still contained value of ZERO, i ran the background job again and now i am getting the below spool message

Macro Stock On Hand Copy has been execute

No data has been changed; data must not be saved

I have infact changed the data but still macro is not working through background job.

Any pointer will be greatly appreciated.

Regards

Pawan.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Pawan,

Stock on hand key figure is auxiliary key figure and gets calculated by stock balance macro set as default. This value is not stored in that key figure hence if you run in background you will find value as zero.

Hence to calculate value in background I suggest you to create a new macro for new z key figure with the same logic as of stock on hand KF.

Now, to populate the values in z key fig in background, first execute workdays macro in background and then this newly created macro.

This should populate values correctly.

Best regards,

Vaibhav

Former Member
0 Kudos

Hi Vaibhav,

I see 3 Stock on Hand Macros under Stock Balance Macro.

Macro 1 ( Stock on Hand Initial) is to calculate Stock under the initial bucket. This macro runs in only initial bucket for Stock on Hand- projected- Key figure

Macro 2 (Stock on Hand) is to calculate stock on hand -projected- from the time bucket you see in your planning book to your Planning book end horizon

Macro 3 (Stock on Hand Display) is used to display either stock on hand ( not projected) or Supply shortage.

I have used the same logic of Macro1 and Macro 2 and replaced Stock on hand-projected- Key figure with my Z Key figure.

I have also created a batch job where i am first running workdays macros and then my developed macro, but i am seeing strange results. Whatever value is getting calculated under initial bucket for my Z Key figure, same Value is getting displayed in all buckets.

Just wanted to cross check with you if i am on right track. pls advice.

Regards

Pawan.

Former Member
0 Kudos

Hi Pawan,

I think we are missing few steps, as you copied standard macro you must have used standard "total demand" and "total reciept" key fig for your macro as well. Now these KF's are also auxiliary.

I think you need to add two more extra Z KF's to calculate first "total reciepts" and "total demand". And use those in ur macro.

Hope this helps.

Best regards,

Vaibhav

Former Member
0 Kudos

Hi Vaibhav,

Issue is solved now completely. Here is the solution which i have done using a macro which has 3 steps in it

1) Step 1: Copy initial stock to Z Key Figure for Current Week only

2) Step 2: Perform Stock on Hand projections ( Similar to Standard Macro) for Current Week only

3) Step3: Perform Stock on Hand projection for future weeks by using the Current week Stock Value. This will ensure that whatever stock value macro calcuates for any week is used in Immediately succeeding week.

I have not shceduled workdays Macro in the job but still the values are correct. Just wanted to know from you the reason you have suggested to use workdays macro as the first step in the job.

And i have awarded full points to you :-). Thanks once again since you provided us critical inputs.

Regards

Pawan.

Former Member
0 Kudos

Dear Pawan,

Good to hear from you that problem is resolved.

We had done similar kind of developments earlier and at that time were calculating target stock level also in Z KF. At that time macro was not calculating values correctly and it got resolved after first executing "workdays" macro. Since to check the demand for "safety no of days" system first needs to determine workdays and then sum up demand for those workdays.

Best Regards,

Vaibhav

Answers (0)