Wednesday, November 18, 2009

Note 380352 - DP 3.0: User exit / Business Add Ins

Summary

Symptom

In the Demand Planning, user exits and Business Add Ins are available to extend standard functions or to map own functions.
This note contains brief information on the options.
If you need more details refer to the documentation.

Other terms

User exit, BAdI

Solution

With regard to user exits, Note 147522 is also valid for Release 3.0.

  • A Business Add In is the new form of user exit. It is object-oriented. For certain objects / actions, the standard system calls up an additional method which you can remove as a customer.
    • To do this, start Transaction SE18, enter the definition name and choose 'Create implementation' per menu option
    • All the methods are located in 'Interface'. By double-clicking on one of these methods you go to its implementation section.
    • If you choose 'Goto => Class definition', you see the parameter settings and reference type specification displayed.



The following BAdIs are available

  • /SAPAPO/SDP_COLWIDTH - Planning Period Column Width Default
    • In parameter CV_AGC_WIDTH, change the column width depending on planning book, data view and grid (top/bottom).
  • /SAPAPO/SDP_EXTRACT - Extract Planning Area Data
    • You use method CHANGE_INPUT to override the input parameters for the extractor (sent by the requesting system).
    • You use method CHANGE_OUTPUT to change the extracted data, by enhancing it, for example.
  • /SAPAPO/SDP_FIXWIDTH - Fix Column Width for InfoObjects
    • You use parameter CV_COL_WIDTH to override the column width (dependent on characteristics) of fixed columns that are expanded during a drill down.
  • /SAPAPO/SDP_HEADER - HEADER
    • You can change / extend the detailed header information.
  • /SAPAPO/SDP_INTERACT - Interactive Planning
    • You use method FCODES_EXCLUDE to gray out standard functions that you no longer want your user to be able to choose.
    • You use method USER_FCODES_CALCULATIONS to implement your own functions that neither macros nor user exits are able to cover. Under FCODES, you must first release a function code (by entering a description). This released function code (for example, +CUS01) is then displayed automatically in the menu, which then, when selected executes the method.
    • You use method PIVOT_ORDER_SET to automatically set the column sequence after a drill down or 'display dependent objects'.
    • You use method TEXT_CHOOSE to choose between using a short text, a medium text, or a long text.
  • /SAPAPO/SDP_MASTER - Characteristic value combinations
    • You use method CHECK_MANUAL_INPUT to check your manual entries for creating or deleting characteristic value combinations.
    • You call up method COMBI_ENRICH to create characteristics combinations (manually / automatically). You have the option of revising or extending combinations.
  • /SAPAPO/SDP_PROMOT - Promotion
    • Notes: 356589 & 361640
  • /SAPAPO/SDP_RELDATA - Release of DP to SNP
    • You use method CHANGE_RELDATA to edit the requirements released from DP to SNP (quantities / dates).
  • /SAPAPO/SDP_RELSTRAT - Set Requirement Strategy on Release
    • You have the option of dynamically setting the requirement strategy.
  • /SAPAPO/SDP_SELECTOR - SDP Selector
    • It is only possible to use Business Add-In '/SAPAPO/SDP_SELECTOR' to extend customer-specific SDP Selector standard functions in interactive planning. Note '399508' details the BAdI methods and how they can be used. Note '377497' provides a sample method implementation code.


See note 394076 for User Exit advice on Forecasts

Header Data



Release Status:Released for Customer
Released on:26.12.2002 17:44:43
Master Language:German
Priority:Correction with low priority
Category:Consulting
Primary Component:SCM-APO-FCS Demand Planning

Affected Releases

Software
Component
Release
From
Release
To
Release
And
subsequent
SAP_APPL
46C
46C
46C
SAP_APO
30
30A
30A
SAP_APO
310
310
310

Correction delivered in Support Package

Support
Packages
Release
Package
Name
SAP_APO
30A

Related Notes




576015 - Collective Consulting Note for Demand Planning

394076 - Consulting: USER-EXITS and BAdIs in the forecast environment

387594 - DP 3.0: SDP_INTERACT => USER_FCODES_CALCULATIONS not called

Note 418801 - Creating a user exit macro

Summary

Symptom

You cannot use a standard macro.

Other terms

Macro
Macro/SAPAPO/SDP94
/SAPAPO/SNP94

Reason and Prerequisites

Possible causes:

  • Parameters required to calculate the line entries are not available in the macrobuilder and must first be generated from database tables.
  • More complicated calculations are necessary to determine the line entries.
Solution

You can create a user exit macro to correct the problem. We shall outline the exact procedure for this below.

As of SCM Release 5.0, we recommend that you use a Business Add-In (BAdI) macro instead of a user exit macro (see SAP online documentation).

Creating the macro
  • Use Transaction /SAPAPO/ADVM to call the macrobuilder.
  • Select a macro book.
  • Use Drag and Drop to move the icon labeled 'User exit macro' from the Shuffler into the middle of the screen and attach it to the icon with the name 'Macro'. Rename it.
  • If required, link the user exit macro icon you have just created with one of the event icons located in the right-hand screen.
Creating the user exit
  • Start Transaction SMOD.
  • Enter APODM005 in the 'Enhancement' field. Select 'Display'.
  • Then choose 'Components' or Shift+F11 and double-click the name of the function module.
  • Double-click the include contained in the function module to enter the source code.
Interface

Below we exaplain how to fill the interface of the user exit. The user only fills or changes the following tables:

    • T_C_TAB
    • T_E_TAB_OLD


The T_C_TAB table is the actual output table in this case. T_E_TAB_OLD provides information about data changes and must be maintained for technical reasons. All other tables act as input parameters.

The values on the planning board are stored under the V field name in the T_C_TAB table. The table entries are explicitly defined by their Z line index and their C column index. The T_I_COLS table provides the column information here while the line information is returned from an inner join via the T_I_PLOB_VALUES and T_I_LINES tables.

The parameters of the following tables are used to calculate lines and columns:

Interface parameter
------------------------------------------------------------------
| Table | Field | Description |
------------------------------------------------------------------
| T_I_COLS | VONTG | Lower date limit |
| T_I_COLS | BISTG | Upper date limit |
------------------------------------------------------------------
| T_I_PLOB_VALUES | SELECTION | Table composed of the |
| | | IOBJNM characteristic and a |
| | | range structure |
| T_I_PLOB_VALUES | PLOBJ | (for join condition) |
| T_I_PLOB_VALUES- | IOBJNM | Technical name of the |
| SELECTION | | rel. characteristic |
------------------------------------------------------------------
| T_I_LINES | FELDH | Technical name of the |
| | | rel. key figure |
| T_I_LINES | GRIDNR | Name of the rel. grid |
| T_I_LINES | KRIT1 | (for join condition) |
------------------------------------------------------------------
| T_C_TAB / T_E_TAB_OLD | Z | Line index of planning board |
| T_C_TAB / T_E_TAB_OLD | C | Column index of planning board |
| T_C_TAB / T_E_TAB_OLD | V | num. planning board entry |
------------------------------------------------------------------


To manipulate the planning board entries, you must use the source code of the user exit to adjust the grid entries of the T_C_TAB table appropriately. In this case, each individual cell is addressed using the coordinates of the grid. Proceed as follows:

  • Determine column C from the T_I_COLS table depending on the VONTG and BISTG date limits.
  • Use the internal table T_I_PLOB_VALUES-SELECTION to check that the solution is unique and, if necessary, determine T_I_PLOB_VALUES-PLOBJ.
  • In table T_I_LINES, use the following key fields
    • T_I_PLOB_VALUES-PLOBJ
    • FELDH
    • GRIDNR = '001'

to determine the line number Z = T_I_LINES-LINE.

  • In the T_C_TAB table, enter the required value for the determined line and column index under T_C_TAB-V.
  • If you want to change a value for the table, save the earlier T_C_TAB entry in the table with the same structure, that is, T_E_TAB_OLD. If you enter a new value into the T_C_TAB table, you must insert a null value into the T_E_TAB_OLD table for the corresponding rows and column number.
Notes
  • If you want to make changes at the lowest level of granularity, you must ensure that your selection is unique. We shall only consider this case here.
  • You can find the technical names for key figures and characteristics in Transaction /SAPAPO/SDP8B.
Sample code

The following function module fills all buckets for the FELDH key figure within the time interval VONTG to BISTG with a constant value V. The selection is determined by the IOBJNM and CHAR_VAL fields, whereby the first field provides the technical name of the characteristic and the second indicates the value of the characteristic.

FUNCTION zfill_buckets
*"----------------------------------------------------------------------
*"*"Global interface:
*" IMPORTING
*" VALUE(I_CUBE) TYPE /SAPAPO/INFOCUBE
*" VALUE(I_LAYOUT) TYPE /SAPAPO/LAYOUT
*" VALUE(I_SCTYP) TYPE /SAPAPO/SCTYP
*" VALUE(I_MACRO_NAME) TYPE /SAPAPO/TXMAK
*" VALUE(I_ACT_PLOBJ) TYPE /SAPAPO/PLOBJ
*" VALUE(VONTG) TYPE BEGDA
*" VALUE(BISTG) TYPE ENDDA
*" VALUE(IOBJNM) TYPE /SAPAPO/IOBJNM OPTIONAL
*" VALUE(CHAR_VAL) TYPE /SAPAPO/CHAVL
*" VALUE(FELDH) TYPE /SAPAPO/IOBJNM
*" VALUE(V) TYPE I
*" TABLES
*" T_I_PLOB_VALUES TYPE /SAPAPO/DM_T_PLOB_VALUES
*" T_I_DRILL_HIER STRUCTURE /SAPAPO/PGAN
*" T_I_LINES STRUCTURE /SAPAPO/MCP6_LI
*" T_I_COLS STRUCTURE /SAPAPO/PGCOLS
*" T_C_TAB STRUCTURE /SAPAPO/MXSOP
*" T_E_TAB_OLD STRUCTURE /SAPAPO/MXSOP
*"----------------------------------------------------------------------
DATA: l_selection LIKE LINE OF t_i_plob_values-selection.
DATA: l_line LIKE LINE OF t_i_lines.
DATA: l_tab LIKE LINE OF t_c_tab.
DATA: l_col LIKE LINE OF t_i_cols.
DATA: l_column LIKE t_i_cols-column.
DATA: l_cnt TYPE i.
DATA: l_gridnr TYPE char3 VALUE '001'.
DATA: l_index LIKE sy-tabix.

* read table t_i_cols index 1 into l_col.
LOOP AT t_i_cols INTO l_col WHERE bistg <= bistg
AND vontg >= vontg.
l_column = l_col-column.

LOOP AT t_i_plob_values.
* For checking uniqueness calculate # entries
CLEAR l_cnt.
LOOP AT t_i_plob_values-selection INTO l_selection
WHERE iobjnm = iobjnm
AND low = char_val.
l_cnt = l_cnt + 1.
IF l_cnt > 1.
EXIT.
ENDIF.
ENDLOOP.

IF sy-subrc <> 0 OR l_cnt > 1.
CONTINUE.
ENDIF.
READ TABLE t_i_plob_values-selection WITH KEY
iobjnm = iobjnm
low = char_val
z = l_line-line
c = l_column
TRANSPORTING NO FIELDS.
* store old value
IF sy-subrc = 0.
MODIFY t_e_tab_old FROM l_tab INDEX sy-tabix.
ELSE.
APPEND l_tab TO t_e_tab_old.
ENDIF.
* store new value
l_tab-v = v.
MODIFY t_c_tab FROM l_tab INDEX l_index.
ENDLOOP.
ENDLOOP.

ENDFUNCTION.

Header Data



Release Status:Released for Customer
Released on:16.02.2006 09:45:22
Master Language:German
Priority:Correction with medium priority
Category:Consulting
Primary Component:SCM-APO-FCS-MAC MacroBuilder
Secondary Components:SCM-APO-SNP-MAC MacroBuilder

Affected Releases

Software
Component
Release
From
Release
To
Release
And
subsequent
SAP_APO
30
30A
30A
SAP_APO
310
310
310
SCM
400
400
400
SCM
410
410
410
SCM
500
500
500
SCM
510
510
510

Related Notes




1045639 - Consulting notes in SNP/CTM

539797 - Collective consulting note on macros

Tuesday, November 10, 2009

Production Process Model (PPM): Settings for CTM

If you create a PPM for Capable-to-Match (CTM), note that CTM does not support setup matrices or teardown activities.

CTM does not use all settings from the PPM. This table lists the settings that CTM does use:

Screen/tab page

In this field...

Initial screen

· Plan number

· Use

Plan

· Multilevel Costs (Fixed)

· Status

Operations

· Operation

· Description

· Operation type

Activities

· Activity number

· Description

· Activity category

· Scrap in percent (time and version dependent)

Logical components (only PP/DS PPM)

· Description

· Input/output

Alternative components

· Product

· Input/output indicator (only SNP PPM)

· Storage

· Date from

· Date to

· Unit of measure

· Material consumption (variable)

· Material consumption (fixed)

· Time-dependent data

· Prevention of product explosion

Modes

· Mode

· Mode Priority

· Primary Resource

· Location

· Unit of measure (in the case of SNP PPM: only Day is allowed)

· Duration (variable)

· Duration (fixed)

· Time-dependent data

· Break not allowed

· Break without interruption

Resources

· Resource

· Location

· UoM for continuous consumption

· Continuous consumption (variable)

· Continuous consumption (fixed)

· UoM for bucket consumption

· Bucket consumption (variable)

· Bucket consumption (fixed)

· Time-dependent duration

Activity Relationships ® Predecessor/Successor

· Operation name

· Activity number

· Reference type (only end-start)

· Unit of measure

· Usage min.

· Process-related minimum interval

· Usage max.

· Maximum interval

· Mode linkage (only via primary resources)

Product-plan assignment

· PPM name and description

· Validity (date/time)

· Planning location

· Production location

· Minimum and Maximum Lot Size

· Procurement Priority