cancel
Showing results for 
Search instead for 
Did you mean: 

Step by step to create planning book & Macro's behind it I am a ABAPer

Former Member
0 Kudos

Recently I have been shifted from R/3 to Apo ; Want to know the creation of planing book & the creation of Macro workbench playing behind planning book .

To create planning book.

To create Macro & how to relate a planning book with the macro.

Step by step process from simple to complex .

Different process to programe a macro .

I can understant ( rather I know ) how to relate a badi (Enhancement spot ) to a macro & but please guide me how to define a row of a planing book : such as how to define the row 'Avg Weekly Forcast' of planing book in a single varriable as 'ZAVGWKFST' to capture it at badi in the parameter I_T_LINES[]

(component - FELDH).

To create a custom Button in a planning book & how to program.

I have many broken links while I try to know it by myself.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi there,

To start with,

1) you need to create info-objects (characteristics and keyfigures) in Transaction RSA1

2) Create a planning area with Tr /sapapo/msdp_admin

Then select your planning area and goto the change mode.

You would see a table on left "Planning Area" and a table on right "Copy fr" with some infobjects.

The fields from Copy fr are the ones created as infoobjects in RSA1. You need to select your info-objects and transfre them to the left table.

Thus your KF's are added to the planning area.

3) After the creation of the planning area, goto transcation /sapapo/sdp8b and create a planning book.

You can assign your keyfigures to the planning book and then create one or multiple dataviews with

the required keyfigures.You need to transfer the relevant KF's from planning area table to planning

book table.Also assign the relevant KF's to the dataview.

Thus you have your planning book and dataview created.

4) once you have the planning book and dataview ready, you create macros.

Macro's are calculation formulae just like ABAP Formulae.You can have standard macros and user

exit macro.You can have pushbutons for both, on execution of which , you run the formulae.

For standard macros, you define in APO macro builder - Tr /sapapo/advm.

For User exit macro's you write your code in ZXDMUSERU05.

Please let me know if you need more information.

Former Member
0 Kudos

Hi,

Generally using a user exit, we only make small or complex modifications.

But I want a Key Figure to be calculated only based on the formula I give in the User Exit. And not just a modification of the existing formula behind it.

Is that possible?

Regards,

Nageswara

former_member187488
Active Contributor
0 Kudos

Hello Nageswara,

Not sure about your request, but it seems that creating user-exit macro is a way to your purpose ...

Or if you mean you want to apply your own logic of calculation like disaggregation -- This would not be possible, since disaggregation happens in liveCache, it is not controlled by ABAP coding.

Best Regards,

Ada

babu_gavi
Explorer
0 Kudos

Hi Anuradha,

your answer is very helpful, i need some information about MACROS in APO.

i. i want to edit the existing macro and i want to apply some conditions and some colors for the same MACRO.

---from which Tcode i want to do the same and how to do it.if its possible can you provide you explanation with screenshots..

or else if you know any good article for above please provide the link..

thanks in advance

Former Member
0 Kudos

Babu,

Did you actually read the extensive section written by expert Umesh above, where he describes how to create a MACRO?  Have you actually tried any of his detailed instructions?

Did you perform your search of SCN, where there are already hundreds of discussions about this topic; to say nothing of the SCN documents and Wikis that are posted?

Read the SCN rules of engagement:

Especially Item 3 under Etiquette.

and

To your question, try these for a start:

Advanced Macros - Planning Area Administration - SAP Library

and then

Best Regards,

DB49

Answers (2)

Answers (2)

0 Kudos

Hi amitabha,

Please find below the detailed steps to define a planning book:

A planning book defines the content and the layout of the interactive planning screen. Planning books are used in Demand Planning and Supply Network Planning. They allow you to design the screen to suit individual planning tasks. A planning book is based on a planning area. You can create several user-specific data views in a planning book. In this step, you create a planning book for Demand Planning.

Procedure

1. Access the activity using one of the following navigation options:

SAP SCM menu Advanced Planning and Optimization  Demand Planning  Environment  Current settings  Define Planning Book

Transaction code /SAPAPO/SDP8B

2. Enter the planning book DP_001 and choose Create.

The Planning Book Wizard dialog box is displayed.

3. Make the following entries:

Field name User action and values

Planning Book Enter the planning book DP_001

Planning book text Demand Planning

Planning area Select the planning area DP_001 and choose Enter

Manual Proportion Maintenance X

Promotion X

Univariate forecast X

4. Choose Continue.

5. Assign the following key figures from planning area to the planning book by using drag and drop or choose Add all new Key Figures to add all key figures:

Description Value Comment

History 9AVHISTORY Relevant for Scenario MTS

Forecast 9ADFCST Relevant for Scenario MTS and VMI

Promotion 1 9APROM1 Relevant for Scenario MTS

Forecast (addition.) 9AAFCST Relevant for Scenario MTS

Planned Price 9APRICEFC Relevant for Scenario MTS

Sales Forecast 9AREVFC Relevant for Scenario MTS

Production (Planned) 9APPROD Relevant for Scenario MTS

Manual Correction 9AMANUP Relevant for Scenario MTS

Additional Field 1 9AADDKF1 Relevant for Scenario VMI

Additional Field 2 9AADDKF2 Relevant for Scenario VMI

Additional Field 3 9AADDKF3 Relevant for Scenario MTS

Additional Field 4 9AADDKF4 Relevant for Scenario MTS

Additional Field 5 9AADDKF5 Relevant for Scenario MTS

The Proportional factor APODPDANT key figure is automatically added to your planning area when you create the planning area. You do not have to add this key figure yourself and assign it to the planning book in this step. When you create the respective view, this key figure will be automatically there for your selection.

6. Choose Continue.

7. Assign the following characteristics from the planning area to the planning book by using drag and drop:

Description Value

APO Location 9ALOCNO

APO Product 9AMATNR

Brand 9ABRAND

Sales Organization 9AVKORG

APO Destination Loc. 9ALOCTO

The characteristic 9AVERSION (APO Planning Version) will be added to the planning book automatically after you complete this step.

9. Choose Continue to go to the Data View tab (the Key Fig. Attrib tab is available in the change mode only after you have completed the planning book).

10. On the Data view tab; enter the following values:

Field name User action (Scenario MTS) User action (Scenario VMI)

Data view DP_Standard VMI_Standard

Data view description Demand Planning Demand Planning

TB profile ID (future) DP_4Weeks_5Month DP_4Weeks_5Month

TB profile ID (history) DP_12Month DP_12Month

Status 3 (Changeable) 3 (Changeable)

11. Choose Enter.

12. Select Visible and select the date as of which you wish the past planning horizon to be visible when this data view is opened.

13. Choose Continue, and assign the following key figures from the planning book to the data view for either the MTS or the VMI scenario, keeping the same order as in the table:

Make-to-Stock

Key Figures Description

9AVHISTORY History

9ADFCST Forecast

9APROM1 Promotion 1

9AAFCST Forecast (additional)

9APRICEFC Planned Price

9AREVFC Sales Forecast

9APPROD Production (Planned)

9AMANUP Manual Correction

9AADDKF4 Additional Field 4

Vendor-Managed Inventory

Key Figures Description

9AADDKF1 Additional Field 1

9AADDKF2 Additional Field 2

9ADFCST Forecast

14. Choose Complete.

15. When the Planning Wizard prompt appears, choose Yes to complete the planning book and data view.

16. On the initial screen, change the planning book you have just created by choosing Edit.

17. If you are installing the VMI scenario, continue with step 21 (entering a free text for the key figures).

If you are installing the Make-to-Stock scenario, repeat steps 9 to 12 to create the following views:

Views View Description Key Figures

DP_CLP COLLABORATIVE DEMAND PLANNING

History

Forecast

Forecast (additional)

DP_RELEASE DEMAND PLANNING - RELEASE VIEW

Manual Correction

18. On the Data View tab page, specify the following TB profile IDs for the DP_RELEASE view,

Field name User action and values

TB profile ID (future) DP_12Month

TB profile ID (history) blank

19. Create the remaining views for the Make-to-Stock scenario according to the steps 9-12:

Views View Description Key Figures

DP_LOGISTICS DEMAND PLANNING - LOGISTICS VIEW

Forecast

Production (Planned)

DP_SALES DEMAND PLANNING - SALES VIEW

History

Forecast

Forecast (addition.)

Planned Price

Sales Forecast

Manual Correction

DP_PROP DEMAND PLANNING - PROPORTIONAL FACTOR VIEW Proportional Factor

To modify the proportional factors manually, you need to create a separate data view containing only the APODPDANT key figure to control the authorization to change these factors. This key figure is a default value in the view and is thus invisible, so you do not need to assign any key figure from the right list in this view.

20. Choose Complete.

21. Go to the Key fig. attributes tab, select the FreeText radio button and make the following entries for each key figure. Choose Save Setting after entering the data for each key figure (depending on your scenario).

Key Figures Free Text Relevant for scenario

9AVHISTORY Historical Data MTS

9ADFCST Statistical Forecast MTS and VMI

9APROM1 Promotion MTS

9AAFCST Sales Forecast MTS

9APRICEFC Planning Price MTS

9AREVFC Sales Revenue Forecast MTS

9APPROD Logistics Forecast MTS

9AMANUP Final Forecast MTS

9AADDKF1 VMI Historical Data VMI

9AADDKF2 VMI Customer Forecast VMI

9AADDKF3 u2013 MTS

9AADDKF4 Forecast Deviation MTS

9AADDKF5 Customer Forecast MTS

22. Choose Complete and exit the planning book maintenance.

Steps to create macros in macro wrokbench:

3.7 Creating Macros (SAP APO)

Use

You can use advanced macros to perform complex calculations quickly and easily. Macros are executed either directly by the user or automatically at a predefined point in time. When defining advanced macros, you work in a special desktop environment known as the MacroBuilder.

In total, four macros are created in the Demand Planning building block. They are all defined for the planning book DP_001. You create three macros for forecast calculation according to the following instruction. The chapter Creating the Macro for Consensus-Based Planning describes how to create the alert macro for consensus-based planning.

In the DP_STANDARD view of the planning book DP_001, you create two macros:

The first macro is used for the standard and consensus-based planning. The system calculates the arithmetic average of Statistical Forecast, Sales Forecast and Logistics Forecast, the result of average forecast data plus Promotion Data is inserted in the Final Forecast cell. It enables the user to consider the forecast input and the promotion plan from different departments within the company. The planner can make manual adjustments and enter the final agreed forecast into the Final Forecast cell. All of this information can be shown in the planning book screen.

The second macro multiplies the Final forecast data with the Planned price to calculate the sales volume. The third macro is an alert macro used for highlighting exceptional situations in consensus-based planning.

In the DP_SALES view of the planning book DP_001, you create the fourth macro. This macro multiplies the Final forecast data with the Planned price to calculate the sales volume, which is the same as the one in the standard view.

3.7.1 Creating Macros for the Standard View

1. Access the activity using one of the following navigation options:

SAP SCM menu Advanced Planning and Optimization  Demand Planning à Environment à Current settings à Define Planning Book

Transaction code /SAPAPO/SDP8B

2. Enter the name of the planning book: DP_001

3. Select Data view DP_standard.

4. Choose Edit.

5. Choose MacroBuilder  MacroBuilder  Data view.

3.7.1.1 Creating the Macro for Consensus-Based Planning

1. Right-click the macro node below the planning table and choose Create New Macro  Add macro. In the APO Macro Builder dialog box, enter a descriptive text for the macro, for example, Forecast + Promotion  Final Forecast. Choose Continue.

2. Right-click the macro and choose Add macro Element  Step.

In the APO Macro Builder dialog box, in the descriptive text section, enter a name for the macro step, for example, First Step and choose Continue.

3. Right-click the macro step and choose Add Element (Result Level) à Add results row.

In the APO Macro Builder dialog box, choose Final Forecast in the Row field. Choose Adopt.

4. Right-click the result row you have just created and choose

Add Element (Argument Level) à Add Operator/Function.

In the APO Macro Builder dialog box, choose u201C(u201C.

5. Right-click the operator/function you have just created and choose

Add Element (Argument Level) à Planning Table Element à Append argument row. In the APO Macro Builder dialog box, choose Statistical Forecast in the Row field.

6. Right-click the argument row you have just created and choose

Add Element (Argument Level) à Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C+u201D.

7. Right-click the operator/function you have just created and choose

Add Element (Argument Level )  Planning Table Element  Append argument row. In the APO Macro Builder dialog box, choose Sales Forecast in the Row field.

8. Right-click the argument row you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C+u201D.

9. Right-click the operator/function you have just created and choose

Add Element (Argument Level )  Planning Table Element  Append argument row. In the APO Macro Builder dialog box choose Logistics Forecast in the Row field.

10. Right-click the argument row you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C)u201D.

11. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C/u201D.

12. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, enter u201C(u201D.

13. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201CSIGN()u201D and change it to u201CSIGN(u201C.

14. Right-click the operator/function you have just created and choose

Add Element (Argument Level )  Planning Table Element  Append argument row. In the APO Macro Builder dialog box, choose Statistical Forecast in the Row field.

15. Right-click the argument row you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C)u201D.

16. Right-click the operator/function you have just created and choose

Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C+u201D.

17. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201CSIGN()u201D and change it to u201CSIGN(u201C.

18. Right-click the operator/function you have just created and choose Add Element (Argument Level )  Planning Table Element  Append argument row.

In the APO Macro Builder dialog box, choose Sales Forecast in the Row field.

19. Right-click the argument row you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C)u201D.

20. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C+u201D.

21. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box choose the character u201CSIGN()u201D and change to u201CSIGN(u201C.

22. Right-click the operator/function you have just created and choose Append argument row. In the APO Macro Builder dialog box, choose Logistics Forecast in the Row field.

23. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C)u201D.

24. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, choose u201C)u201D.

25. Right-click the operator/function you have just created and choose

Add Element (Argument Element)  Append Operator/Function.

In the APO Macro Builder dialog box, enter u201C+u201D.

26. Right-click the operator/function you have just created and choose

Append argument row.

In the APO Macro Builder dialog box, choose Promotion in the Row field.

27. Select the macro and choose Check to check it. Generate the macro by choosing Generate.

28. Move the macro by using drag and drop to the Events section and to the Default folder in the upper right screen area.

29. If you want to continue with the configuration, proceed with the next activity to create the Sales Volume Macro (see below).

If you want to discontinue the configuration at this point, we recommend that you save your settings. To do this, go back to the Planning book Design screen and choose Save. Choose All Functional Areas when the confirmation prompt appears.

Hope this should help you.

Regards,

Umesh

Former Member
0 Kudos

Hi Amitabha Raj,

Please follow the below link that I have attached which will take you in detail about planning book design and macros.

http://help.sap.com/saphelp_scm70/helpdata/EN/11/997f4fa1b344b68aa2d25d87b69d58/frameset.htm

Regards

R. Senthil Mareeswaran.