Show TOC

 Calling the Optimization Server from an OCX

The following information is intended for pilot projects. We do not guarantee compatibility, that is, SAP AG reserves the right to change or delete the functions described at any time and with no prior notice.

For this reason, the techniques described below should be implemented in productive scenarios and systems only with the agreement of SAP AG or following consultation with SAP AG. For a consultation, create a customer message under component APO-INT-EXT.

Use

You can call the optimization server from an OCX using the BAPI_APXSRVAPS_REQSRVSTART function. You do this using an event. The import parameters and tables are filled with properties that are read when the event is triggered and are then transferred to the function. After the function is ended, the export parameters and tables are returned to the OCX as properties.

You use the BAPI_APXSRVAPS_REQSRVSTART function to call the /SAPAPO/APX_BADI_01 BAdI with the CHANGE_START_OPT_SERVER_REQ method. This allows you to manipulate the transferred data and use the debugger to check if the function has been called (for example, to test the events from an OCX).

Prerequisites

To start the optimization server from the OCX, you must make the following settings:

In the OCX, define an event for starting the optimization server

In the APX Customizing, specify that the system should react to this event.

Add the following entry in the APX Customizing:

Field name:OCX_START_OPT_SERVER_REQ_EVTID; Field value:<EventID>

Enter the eventID numerical value for the event that you have specified for starting the optimization server. The eventID is not necessarily the name of the event you have defined. In some programming languages you can assign an eventID explicitly to an event. In other programming languages, (for example, VisualBasic ) this is not possible. In this case the eventID can be determined by displaying the TypeLib for this OCX, for example, using the Microsoft OLE/COM Object Viewer (part of the Microsoft Visual Studio ). Depending on the development environment, you can specify the eventID again when adding or deleting events.

Example for VisualBasic:

A “StartOptimizerServer” event is defined in the OCX. An entry exists in the “TypeLib” for this OCX, such as:

dispinterface __OcxExample {

properties:

methods:

[id(0x00000001)]

void StartOptimizerServer([…

The eventID for this event is1