Show TOC

 Data Exchange with an OCX

Note Note

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.

End of the note.

Use

Data cannot be returned directly to an OCX or to the SAP APO system. In this case, only the OCX is started. The information that is made available by BAPI_APXSRVAPSIF_GUISTART, for example, is not directly available.

However, you can enable a data exchange with the OCX through a combination of method calls and properties in OCX. The corresponding methods must be implemented in OXC, or the corresponding SET PROPERTIES and GET PROPERTIES must exist.

Features

Each parameter has its own property. The data exchange with properties is executed using user-defined tables. (Parameters that do not represent table parameters (for example, OPTIMIZER_PARAMS) are interpreted as tables with one entry.)

List of parameter names (for example, from BAPI_APXSRVSIF_GUISTART)

Parameter name

Property name in OCX

OPTIMIZER_PARAMS

SapApoApxOptimizerParams

OPT_PARAMETER_EXT

SapApoApxOptParameterExt

EXTENSION_IN

SapApoApxExtensionIn

EXTENSION_OUT

SapApoApxExtensionOut

RETURN

SapApoApxReturn

If you call up the external optimizer as an OCX, the following times are important:

  • Before data is transferred to the OCX, the properties for the following parameters (that are contained in BAPI_APXSRVAPSIF_GUISTART) are set:

    OPTIMIZER_PARAMS

    OPT_PARAMETER_EXT

    EXTENSION_IN

    After the properties are set, the SapApoApxSetStartValues method is called up in the OCX. The method does not contain any import or export parameters. It is only used to inform the OCX that it is now in control.

  • Before you exit the OCX and before control is returned to the APX, the properties for the following parameters that are contained in BAPI_APXSRVAPSIF_GUISTART, are read:

    RETURN

    EXTENSION_OUT

    After the properties are read, the SapApoApxGetReturnValues method is called up. This informs the OCX that the user wants to exit OCX.

    The method does not contain any import parameters. The method can return a string as an export parameter. If this string contains the value DO_NOT_QUIT , the OCX can prevent the user from quitting the OCX if they choose Back or Exit . If Cancel is selected, the OCX cannot prevent the user from quitting the OCX.

Example

Programming in Visual Basic 6.0:

'************************************************

' -> public properties for APO communication

Private mSapApoApxOptimizerParams As SAPTableFactoryCtrl.Table

Private mSapApoApxExtensionOut     As SAPTableFactoryCtrl.Table

‘ SET Property to receive the parameter OPTIMIZER_PARAMS

‘ the property names are predefined by APX

Public Property Set SapApoApxOptimizerParams(SapApoApxOptimizerParams As SAPTableFactoryCtrl.Table)

' -> set property

    Set mSapApoApxOptimizerParams = SapApoApxOptimizerParams

‘ get the field SHORT_TEXT from the parameter OPTIMIZER_PARAMS

txtTextField.Text = SapApoApxOptimizerParams.Rows.Item(1).Value("SHORT_TEXT")

End Property

‘set property to give parameter EXTENSION_OUT back to APO

Public Property Get SapApoApxExtensionOut() As SAPTableFactoryCtrl.Table

    Set SapApoApxExtensionOut = mSapApoApxExtensionOut

End Property

‘ function which is called if OCX is started from APO

‘ the function names are predefined by APX.

Public Function SapApoApxSetStartValues()

‘ put your coding for initialization here

End Function

‘ function which is called before OCX is destroyed

Public Function SapApoApxGetReturnValues() As String

‘ coding example where a flag indicates if the OCX should be quit or not

    If cboxDoNotQuit.Value = 0 Then

        SapApoApxGetReturnValues = ""

    Else

        SapApoApxGetReturnValues = "DO_NOT_QUIT"

    End If

End Function

'************************************************