segunda-feira, 17 de agosto de 2020

How to use PP/DS planning log and trace

 Introduction

In past months, I was involved in a SAP Supply Chain Management 7.14 implementation project which mainly use APO-CTM and APO-PP/DS modules.  For PP/DS  part, this project has delivered custom scheduling heuristics for customer specific requirement such as schedule plan order and unreleased production order together, or set cross order constraint for the plan order which need to be ended at same time.  In the developing journey of these heuristics, I found log and trace mechanisms are useful for problem analysis.  After these heuristics has been running smoothly in production system, I would like to summary on how to customize/display/delete PP/DS log and trace, and also happy to share with the community.

1      Customizing for PP/DS log

As default settings, PPDS only show warning or error message during PPDS planning run. This also could be changed with customizing. Generally, we could keep the default setting to avoid generate too much log records in APO.

IMG activity: Supply Chain planning ->Global Settings-> Maintain Global Parameters and Defaults.

For the message in planning log, SAP provide Exception Group for these messages, APO would group together these exception message during planning run. The collected problems in exception group would lead to planning being terminated. SAP also provide standard exception group 999 for these error or terminated messages which not belog to specific exception group.

IMG activity: Supply Chain planning -> Application logs for PP/DS ->Maintain Exception Groups

In some problem analysis scenario, especially in interactive planning, we could change logging level to get more detail information. Here are two ways to change the logging level:

  • Set user parameter for PPDS execution user account:

/SAPAPO/WHAT_PL: Level of Detail for PP/DS Planning Log: User-Dependent, set D as detail information would be logged.

  • Set logging level during Interactive Planning

Ex. in transaction /sapapo/rrp3, menu path: Settings->Planning Log

2     How to display planning log

Scenario 1: Run PP/DS heuristic in Interactive planning

After running product heuristic, you could check the log with “Display Logs”  in “Go To ” menu items.

If we use logging level as “Only errors, terminatins and warnings ”, less information would be found in log.

less%20log%20info

less log info

If we set log level to “All messages”, there is much more detail information could be found.

more%20log%20info

 

Scenario 2: Run PP/DS heuristic in background

For this scenario, you could invoke transaction /SAPAPO/RRPLOG1 to display log

3      Add info to log in custom heuristic

You don’t need to call BAL* function module directly to create log item. In heuristic implementation function module , you could call function module /SAPAPO/OM_MESSAGES_SY_STORE  to add message.

Codes example:

           MESSAGE s008(ZPPDS) WITH ls_msg-v1 INTO DATA(lv_message).
            CALL FUNCTION '/SAPAPO/OM_MESSAGES_SY_STORE'
              EXPORTING
                iv_msgty         = 'S'
                iv_write_message = gc_true.

4     Delete planning log

You could run transaction /SAPAPO/RRPLOG2 or SLG2(Report SBAL_DELETE) as background job to delete log regularly.

  • /SAPAPO/RRPLOG2: Delete PP/DS log
  • SLG2: Delete expired application log

5      Scheduler Log

Detailed scheduling is important part in PP/DS, and PP/DS application call LiveCache scheduler to schedule activities of plan order or production order. LiveCache scheduler is used to determine the start time and end time of activities with constraints on resources according to predefined scheduling strategy. With scheduler log, you could compare start/end time of activity between before and after scheduling. He

5.1       Enable Scheduler log in Detailed Scheduling Planning board

TX: /SAPAPO/CDPS0

Scenario: there are 8 plan orders which has been scheduled on one resource with infinite strategy and bring resource overload. With finite scheduling strategy, these plan orders would be rescheduled in order.

Detail Scheduling Strategy:

  • Desired Date: Earliest Date
  • Planning Direction: Backward + Reverse
  • Action in case of scheduling error: Terminated Immediately

Before rescheduling, activities are scheduled as below diagram:

Before%20rescheduling

Before rescheduling

With OK-Code SLON2, application would open new window to display scheduler log.

With OK-Code SLON1, application would display scheduler log with current window.

Under “Scheduler Log” node, you could find scheduling has been called two times. And you also could find each activity changes after scheduling.

After rescheduling, these plan orders’ operation are sequenced on resource finitely.

After%20rescheduling

After rescheduling

 

If you want to enable scheduler log when you call DS heuristics in PP/DS planning run, you could set breakpoint before call FM /SAPAPO/OM_ACT_SCHEDULE, change IS_CONTROLPARAMETERS -GET_SCHEDLOG to X, and change global parameter gv_Display_Sched_Log to 2, it will open new window after calling the scheduling function module.

/SAPAPO/EFPL_ONLINE_SCHEDULER-> /SAPAPO/OM_ACT_SCHEDULE

 

5.2       Set trace level

With default settings, scheduler log show the basic information on affected activates. We could set LiveCache OM trace level, then we could get more log information when invoke live cache scheduler. From these log item information, we could know how LiveCache scheduler changes activates in what sequence, and why some activities are scheduled failed.

Here are steps and example on how to set trace level on display the detail information.

Set trace level as 9 for Scheduler API in /SAPAPO/OM02.

Reschedule with above scenario again, we could get more info .

You could fin “Log Items” node under each scheduling.

For the first activity, activity is scheduled as initial situation, no changes occur.

For the second activity, it was rescheduled to another time slot.

For the third activity, there was not slot found for the activity, and the scheduling is terminated. Another scheduling with forward direction is executed again .

Note: because trace level 9 would create trace file on server side. So strongly suggest DON’T set level 9 you’re your scheduling affect a lot actives.

After enabling OM trace, you also could download these trace file with transaction /SAPAPO/OM01. But it is hard to read content of the trace file directly. So it’s better to use scheduler log to display the activity scheduling information.

 

Conclusion:

In this blog post, I showed the steps of customizing PP/DS log and scheduler log globally and interactively, and how to use the scheduler log to analysis the failed reason with an example.  Enable appropriate log and trace level could show activities changes with specific scheduling logic and it also could help user to analysis scheduling issues.

Any comments are welcomed about PP/DS topic.

Thanks.

Nenhum comentário:

Postar um comentário