Ansicht
Dokumentation

APO-OPT: APO Optimization Extension Workbench (APX) ( RELNAPO_30A_SP1_APX )

APO-OPT: APO Optimization Extension Workbench (APX) ( RELNAPO_30A_SP1_APX )

Addresses (Business Address Services)   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

Short text

APO-OPT: APO Optimization Extension Workbench (APX)

Use

The first version of the APO Optimization Extension Workbench in APO was shipped with Release 3.0A (First Customer Shipment and Support Package 1).

Nowadays, optimization plays a key role in supply chain management. Effective optimization tools, which can be adapted to suit the needs of their respective users, have a significant influence on planning and production efficiency and thus represent a critical factor on the market.

Use

The standard optimization facility in the Advanced Planner and Optimizer (SAP APO) allows you to access optimization tools at various points:

  • In strategic planning, when the entire supply chain is built ("network design" component)
  • In tactical medium and long-term planning (supply network planning)
  • In operative production planning (production planning and detailed scheduling)
  • In transportation planning (transportation planning and vehicle scheduling)
  • In the distribution of produced goods (deployment)

The components listed here optimize generic target figures, i.e. parameters such as production costs or lead times, which are of general interest to every company.

Important statistics for individual enterprises or sectors of industry in particular are not taken into consideration here. For example, geometrical or technological constraints could be important for optimizing the sequence of operations on a machine. These can include criteria such as dimensions, weights, temperatures, etc. The most important optimization criteria include minimum waste and maximum machine utilization. These specific constraints and target figures are not taken into account by standard optimizers.

Objectives of the APO Optimization Extension Workbench

The APO Optimization Extension Workbench (APX) provides a new means of making optimization strategies more flexible. The primary purpose of the workbench is to extend the standard planning tools in SAP APO to include user-specific optimization components. These individual optimizers are launched directly from APO. Together with the standard optimizers and heuristics, they form one planning system. This system provides the right degree of flexibility to be adapted to the precise needs of the user.

In addition to the functional integration of the external optimizer in the standard APO component environment, the optimizer is to be incorporated closely so that it can freely use the APO data stock (from the liveCache and the database server). The results of an optimization can then be returned to the APO data stock. This means that a separate database is not required. The connection is realized using BAPI technology.

The constraints and target figures that are so user specific that they cannot be handled by standard optimizers require figures that are not contained in the standard APO data stock. The APO database, therefore, can be extended. New tables can be created and populated. This data is also accessed using BAPI technology.

In this way, external optimizers can be made an integral component of the APO system. As with the other APO components, they are called from APO, access the APO data stock, and then save their results to the data stock again.

Example: "Cutting Optimization"

The objectives outlined above are illustrated by the following example. Coils (rolls of steel) from a rolling mill with a specific width and length are to be cut to size in accordance with the customer's specifications. The resulting products are either smaller coils or sheet-metal plates, which are then delivered to the customer.

The cutting procedure is subject to certain geometrical restrictions: the total width of the coils or sheet-metal plates must not be greater than the width of the original coil. The same applies to the lengths. The blanking waste produced is returned to the steel production process as "scrap".

Whereas the geometrical dimensions "length" and "width" are managed as attributes in characteristics dependent planning, the special restrictions governing these dimensions are not known to the detailed scheduling components in APO. This means that they will not be taken into account and will most likely be violated in standard planning. The objective of minimizing the amount of blanking waste is also an additional optimization criterion that is specific to this type of production and is also unknown to standard optimizers.

An external optimizer is required, therefore, to maintain the constraints and minimize blanking waste. This optimizer can accommodate and correct the incorrect (as far as the additional constraints are concerned) plan in APO and optimize the blanking waste at the same time. The modified production plan is then returned to APO.

Calling an External Optimizer

External optimizers can be called wherever standard optimizers can be started. The most commonly used means of starting optimizers is with the Optimize pushbutton on the planning boards in the "Production Planning and Detailed Scheduling" (PP/DS) and "Supply Network Planning" (SNP) components. Up to now, the relevant standard optimizers were then started.

Procedure

  1. For production planning and detailed scheduling, for example, choose the following from the main APO menu: Production Planning Interactive Production Planning Product Planning Table Start the PP/DS planning table with a suitable profile.
    Note: Choose a planning table that matches the component in which the external optimizer is to be used. Until now, only standard optimizers could be used here.
  2. Choose the Optimize pushbutton on the planning boards in the "Production Planning and Detailed Scheduling" (PP/DS) and "Supply Network Planning" (SNP) components.
  3. Result: The Select Optimizer dialog box is displayed.
    Note: In Customizing, you can specify which optimizers are proposed for selection here. If you have defined more than one optimizer, a menu is displayed first containing a selection of the available optimizers.
  4. Choose an external optimizer. The GUI of the external optimizer is then displayed.
    Note: This window contains the external optimizer GUI within the SAP GUI frame. The APO Optimization Extension Workbench uses Microsoft's ActiveX technology. Since the frame generated by the SAP GUI is an OCX container, the developer of the external optimizer must provide an OCX file. The OCX GUI should allow you to enter parameters for an objective function, such as horizons or weights. The developer of the external optimizer is entirely responsible for designing the GUI, controlling the optimization run, and displaying the result (for example, using the calculated target figures). This also includes the option of embedding the external optimizer in the OCX. In this case, the optimizer runs on the workstation. Alternatively, the OCX (in addition to the GUI) can simply control data exchange between the relevant workstation and a central optimization server. The results are still to displayed in APO in the form of planning tables or other graphics.

Maintaining Customizing Settings

In Customizing, you maintain the external optimizers that are to provided for the SAP APO components and under which OCX key they can be found.

  1. To call up Customizing, choose: SAP Menu->ToolsBusiness-> Engineer-> Customizing.
  2. The Customizing: Execute Project screen is then displayed.
  3. Choose the SAP Reference IMG pushbutton
  4. The Display IMG screen is displayed.
  5. Choose Advanced Planner and Optimizer (APO) -> Basis Settings
    Optimization->Optimization Extension Workbench-> Maintain Master Data for Optimization Extension Workbench
  6. The Change View Optimization Extension Workbench Master Data: Overview screen is then displayed.
  7. Maintain the table as shown below:
Field   Procedure
Identifier   Enter a unique name for an external optimization program
Module   Choose one of the APO modules: Capable-to-Match,
  Production Planning/Detailed Scheduling and Supply
  Network Planning.
Short text   Enter a description of an external optimizer
Status   Inactive: The optimizer is not active and, therefore,
  cannot be called
  Active: The optimizer is active
OCX Key   Enter the key under which the OCX of an external
  optimizer is registered on the workstation

Working with the SAP APO Data Models

The APO Optimization Extension Workbench uses "Business Application Programming Interfaces" (BAPIs) to provide data stored on the database and in the LiveCache to external optimizers. This means that all of the BAPIs provided by SAP APO can also be used by external optimizers.

BAPIs are based on business objects. Typical business objects in SAP APO include locations, products, resources, PPMs, and orders of all types. These objects are assigned methods that allow you to create, read, change, and delete instances of the objects. When you do so, the system takes into account a series of attributes that describe these instances in greater detail. How these attributes are assigned to individual fields and structures in the database or liveCache is not relevant for using the BAPIs. The business object "ManufacturingOrderAPS" (manufacturing order) is primarily in use at present in conjunction with the APX. The following methods are used here:

  • SaveMultiple
    Creates new or changes existing manufacturing orders. Detailed scheduling is then started automatically, which searches APO for a PPM that can be used here, and schedules the associated operations and activities, while taking all of the applicable restrictions into account.
  • ChangePeggingMultiple
    Creates, changes, or deletes the pegging relationships between the INPUT nodes of the order and the OUTPUT nodes of a different order or stock. The associated attributes can also be changed.
  • GetList
    Determines all of the manufacturing orders that satisfy a specific selection criterion. Here, the system reads not only the attributes of the order header, but also all of the input and output products, together with their attribute instances and associated pegging relationships.
  • DeleteMultiple
    Deletes one or more manufacturing orders. All of the associated operations and activities are deleted at the same time.

Working with User-Specific Data

Working with an external optimizer often entails incorporating user-specific data. Since building a separate (external) database to store this data does not make sense, SAP provides the option of extending the existing APO databases. There are two ways of doing this:

  1. Additional data can be modeled as characteristics of individual products. This is part of characteristics dependent planning (CDP) in APO. The characteristics are implemented with the standard APO functionality and can then be interrogated by the external optimizer using the standard BAPIs.
  2. If it is not possible to model additional information as product characteristics, the SAP APO database structure can be extended. Two procedures can be used here:
    1. Existing database tables can be extended by adding new columns. These extensions primarily affect tables for resources, PPMs, orders, and all other elements that are assigned business objects. The data stored in these columns can be accessed using the methods of the relevant business objects. These methods contain ExtensionIn and ExtensionOut parameters at their interfaces for this purpose. These are actually containers, which record the individual table extensions and modifications.
    2. If the additional information cannot be assigned directly to the business objects, it must be modeled and stored in separate tables. Whereas creating and managing these tables is part of SAP Basis (see transactions "se11" and "se16"), access to their content from an external optimizer is provided by a special APO Optimization Extension Workbench module.

Example: User-Specific Tables

The table KOMPATIBLE_STAHLTYPEN is an example of the case described under 2b:

Steel Type   Compatible Steeltype   Degree of Compatibility
A60   A61   1
A60   A65   1
A60   B82   3
A60   B92   3
A60   A60   1
A60   A65   2

This table describes steel types that are compatible with one another. Assume steel of type "B82" is being manufactured at a certainfurnace in a steel works and a sales order for steel type "A60" is received. In this case, an optimizer could choose to start a new furnace or to use the compatible (that is, usually the type with the higher quality) steel type "B82". The degree of compatibility is also specified.

While the steel type of a product can be modeled as a characteristic, the information described above can only be mapped effectively in a separate table.

Creating and Maintaining User-Specific Tables

The names of user-specific tables that are to be used by external optimizers must start with "YAPX_" or "ZAPX_". In other words, the tables are in the customer namespace and are assigned to the APX. The tables are created with transaction "se11". The contents of the tables are created, modified, or deleted with transaction "se16".

Access to User-Specific Tables

External optimizers can access tables in the "YAPX_" or "ZAPX_" namespace using the function module "/SAPAPO/APX_GET_ANY_TABLE". This function module can be called from Visual Basic, C++, and Java programs by means of a remote function call (RFC).

APX_GET_ANY_TABLE only expects the name of the table to be read as an input parameter.

Input Parameter   Type   Length
TAB_NAME   Char   30

The output comprises an ABAP structure and three tables. The structure contains general information on the table to be read:

Result Parameter   Type   Length
TAB_INFO
TAB_NAME   Char   30
NUMBER_OF_COLUMNS   INT1   3
NUMBER_OF_LINES   Int4   10

The first entry simply confirms the table name TAB_NAME, which has already been transferred as an input parameter. In the following section, «TAB_NAME» refers to the table whose name is stored in TAB_NAME (in other words, the table to be read). The other parameters specify the number of columns and rows in «TAB_NAME».

The "TAB_STRUCTURE" table describes the structure of the «TAB_NAME» table, that is, its fields and the respective field type. This information is available from the ABAP Dictionary. TAB_STRUCTURE is structured as follows:

Result Parameter   Type   Length
FIELD_NAME   CHAR   30
FIELD_TYPE   CHAR   1
FIELD_LENGTH   NUMC   6
FIELD_DECIMALS   NUMC   6

The FIELD_NAME field contains the field names that were specified in transaction "se11" when the «TAB_NAME» table was created. FIELD_TYPE is the ABAP data type of the respective field. The following assignments can arise:

C   Character
N   Numeric text
D   Date:YYYYMMDD
T   Time: HHMMSS
X   Byte (heXadecimal)
I   Integer
P   Packed number
F   Float
S   String
x   Bytefolge (X string)

The FIELD_LENGTH and FIELD_DECIMALS fields specify the length and number of decimal places for the relevant field in the «TAB_NAME» table.

The TAB_CONTENTS table specifies the content of «TAB_NAME». Here, each data record is copied field by field from «TAB_NAME» to TAB_CONTENTS. Every data record in TAB_CONTENTS represents a field in «TAB_NAME». The sequence of the data records is identical to that of the data records in TAB_STRUCTURE.

The TAB_CONTENTS table comprises three fields:

Result Parameter   Type   Length   Decimal places
STRING_LIKE   CHAR   128
FLOAT_LIKE   FLTP   16   16
INTEGER_LIKE   INT4   10
TO_BE_CONTINUED   CHAR   1

The data field type (FIELD_TYPE from TAB_STRUCTURE) determines which field in TAB_CONTENTS is filled. Packed numbers are transferred as floats. Even integers are not transformed. All other data is represented as strings.

The only exception is with the transmission of character strings and byte sequences, which can have an unlimited length in ABAP. If these are longer than 128 bytes, they are split into one or more parts. In this case, the TO_BE_CONTINUED field is filled with an X. The next data record of TAB_CONTENTS is then the continuation of the contents of this long data field from «TAB_NAME». This can be repeated as often as required.

The following section illustrates the content of the transferred data structures using the example of the KOMPATIBLE_STAHLTYPEN table mentioned above.

Example: Reading the KOMPATIBLE_STAHLTYPEN Table

The TAB_NAME table has the contents KOMPATIBLE_STAHLTYPEN. Calling "/SAPAPO/APX_GET_ANY_TABLE", therefore, produces the following results:

TAB_INFO-TAB_NAME = KOMPATIBLE_STAHLTYPEN

TAB_INFO-NUMBER_OF_COLUMNS = 3

TAB_INFO-NUMBER_OF_LINES = 79

TAB_STRUCTURE

FIELD_NAME FIELD_TYPE   FIELD_LENGTH   FIELD_DECIMALS
STAHLTYP C   3   -
KOMPATIBLER_STAHLTYP C   3   -
KOMPATIBILITÄTSGRAD I   2   -

TAB_CONTENTS

N_C_D_T_X_S_x   P_F   I   TO_BE_CONTINUED
A60   -   -   -
A61   -   -   -
-   -   1   -
A60   -   -   -
A65   -   -   -
-   -   1   -
A60   -   -   -
A61
A82   -   -   -
-   -   3   -
...   ...   ...   ...

Planning Scenarios in SAP APO

General

The integration of external optimizers in SAP APO is independent of the individual components. The applications for tactical planning (Supply Network Planning, Transportation Planning, etc.) and operational planning (Production Planning and Detailed Scheduling, Vehicle Scheduling) are affected in the same way.

These components, in turn, feature four different planning options:

  1. Standard Heuristics
    Standard heuristics are a means of instantly creating a working plan, i.e. one that takes the specified APO constraints into account. Since the system is to produce a result as quickly as possible, local optimization criteria are primarily used instead of global ones. These are implemented in ABAP.
  2. Standard Optimizers
    Optimizers enhance the results calculated by the heuristics. Global optimization criteria, such as the total manufacturing time, the total setup costs, or the average delay, are used for this purpose. The planning, itself, takes place in the background. Depending on the extent of the problem, this make take from a few minutes up to a few hours. Since optimization algorithms usually have extensive runtimes due to their complexity, they are implemented in C++.
  3. User-Specific Heuristics
    Naturally, users can develop their own heuristics and adapt them to their specific problem. As with standard heuristics, this is done in the ABAP programming environment.
  4. User-Specific Optimizers
    As described here, the APO Optimization Extension Workbench provides the option of integrating user-specific optimization algorithms in SAP APO.

SAP APO allows you to integrate these different planning algorithms in one planning system to fulfill all of the customer's requirements. The algorithms can be started in any order and the planning problem can be processed entirely or just in part (depending on the relevant resources / locations and time period). The potential planning scenarios, in turn, can be adapted here to each individual user.

The following section contains an example of one of these scenarios:

Example: Sequence Optimization in the Steel Industry

The following simplified example from the steel industry is intended to illustrate a potential planning scenario.

Slabs (blocks of unrolled steel) from the steel works are first rolled in a hot rolling mill to form sheet steel with a thickness of a few millimeters. This sheet steel can be treated (for example, anodized, galvanized, coated) in subsequent steps. Although the hot rolling mill can theoretically process orders in any sequence, system wear and tear can be reduced considerably if certain constraints are taken into account. A special sequence optimizer, which is integrated in APO by means of the Optimization Extension Workbench, is used to determine the ideal order sequence.

One of these constraints is that change in the width and thickness of the rolled sheet steel between one rolling operation and the next should be as small as possible. The width of the sheet-steel plates should first increase and then decrease gradually. The thickness of the plates is subject to fluctuations that should be avoided as far as possible.

The individual width and thickness fluctuations are totaled in an objective function. The best sequence is the one in which the objective function has the lowest result. If, in addition to the total fluctuations in thickness and width, different weightings are to be used that can be modified by the user, the result can be changed with regard to one of the constraints.

  1. Production planning for the entire plant can thus be carried out in a number of ways (scenarios): With backwards planning, starting from the sales orders, the operations are first scheduled for the last production unit in such a way that the due date is the same as the delivery date. This ensures that stock is not built up as a result of the product being completed too early, and that customer satisfaction is not jeopardized due to delays. If the system continues to plan backwards in this manner, this will result in a series of operations on the first production unit (hot rolling mill) that usually cause a high level of wear and tear on the machinery. It is extremely likely that this sequence will not satisfy the special constraints, which, if fulfilled, would cause a minimum level of wear and tear. A large number of setup times indicates that worn machine parts are changed frequently.
  2. The second scenario is based on a predefined sequence of operations on the hot rolling mill. These operations can be either derived from the existing sales orders or determined using step 1.
    This sequence will now be changed using the sequence optimizer, while taking into account the additional constraints (that is, the minimum level of wear and tear on the machinery). Forwards planning carried out afterwards ensures that subsequent operations are scheduled in accordance with the relevant relationships or pegging relationships. The operations are scheduled for the other resources in accordance with the sequence of operations in the hot rolling mill. Since the sequence optimizer is not aware of the position of the last operation in a sales order, the due dates are usually violated. The products are either completed too early or too late.
  3. As scenarios 1 and 2 demonstrate, there is a distinct tradeoff between meeting the customer's deadline, on one hand, and optimizing the sequence of operations in the hot rolling mill on the other. All of the objectives can be achieved by applying a combination of both scenarios:
    First, backwards planning is carried out (as in scenario 1). The location of the operations on the hot rolling mill can be regarded as ideal as far as meeting the due dates is concerned. Every shift in any of these operations to the left makes it more likely that production for the associated sales order will be completed too early. Any shift to the right will probably cause production to be delayed. As far as the due dates are concerned, therefore, as few operations as possible should be shifted on the hot rolling mill, and, if so, this shift should be minimal. The total distance of all the operations from their original position can be regarded as a measure of the "similarity" between the processing sequence specified by the optimizer and the original sequence.

This measure of similarity is also included in the optimization as a target figure. As already described above, the objective function is defined as the total of all the individual weighted target figures. The measure of similarity can be regarded as a target figure and, therefore, must also be minimized. Once it has been assigned a weighting, it is included in the total of the remaining target figures, and thus in the objective function. The weighting is the central element that defines the quality of the end result. If it is high, there will be little change to the sequence of operations on the hot rolling mill so as to favor the due dates. If it is low, the sequence, in particular, will be optimized.

In a further step, the total number of shifts to the left on the planning table (towards the past) can be distinguished from those to the right. By using different weightings, shifts to the left or right can be assigned different penalties. Depending on these, either completion of the sales orders too early or a delay will be permitted. By changing the weightings, the end result of planning can be modified to accommodate completion of the sales orders too early, their delay, or a less favorable sequence of operations on the hot rolling mill.

The operations shifted to the right on the planning table, in particular, can bring about a violation in the relationships to subsequent operations (for other resources). In order to correct this and optimize the remainder of the plan at the same time, the schedule for the remaining resources must be determined with the APO PP/DS Optimizer. The optimized operation sequence must be fixed in advance. In this way, the aforementioned violations will be corrected.

In short, an optimum production schedule can be calculated with the following scenario:

  1. The heuristic calculates a proposal for system planning.
  2. The sequence builder optimizes the sequence of operations on the hot rolling mill, while taking the total number of changes to the original schedule into account.
  3. The standard optimizer corrects any violations to relationships and optimizes the schedule for the remaining resources.

This example shows how standard heuristics and user-specific optimizers can be combined to solve a scheduling problem. The procedure illustrated here is typical for many of the problems associated with sequence optimization. However, there are also other technically-related tasks involved in optimizing individual systems or entire enterprises in different sectors of industry. The APO Optimization Extension Workbench can be used in a similar manner to plan transportation in accordance with certain constraints and objectives, and for planning in the medium and long term.

See also

For further information on individual Basis components that are required to support the relevant APX functionality, please refer to the following documents, links, and training courses:

1. APO BAPIs Function module documentation (SE80)
Transaction BAPI
http://sapneth5.wdf.sap-ag.de:1080/bapi
(Open BAPI Network)
2. Calling BAPIs
a) BAPI OCX SAP-Library--> Basis--> Services
  Communication Interface --> Remote
  Communications
  --> SAP Automation
  http://sapnet.com/bapi-->COM section
  http://www.saptechjournal.com-->Archive
  Training: CA926 and CA927
b) DCOM Connector RFC SDK Kitab 4.5A (SAP Presentation CD):
  rfcsdk\ccwww
http://sapnet.sap.com/connectors
  http://www.saptechjournal.com
  http://sapnet.sap.com/bapi
3. ABAP Dictionary
(se11) ABAP/4 Development Workbench: ABAP/4 Dictionary
  (Chapter 12: Maintaining Tables)
4. Data Browser
(se16) ABAP/4 Development Workbench: ABAP/4 Dictionary
5. Customer
Enhancements SAP-Bibliothek-->Basis-->Middleware-->BAPI
  BAPI Programming Guide'-->Modifications
  and customer enhancements.
Customer Modifications and Inhouse DevelopmentsBAPI Programming
6. Using RFCs http://www.saptechjournal.com
  Training courses: see 2a)







Addresses (Business Address Services)   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 42353 Date: 20240329 Time: 063018     sap01-206 ( 681 ms )