CANCEL_UC_OBJECT

Script Function: This is used to terminate an activated object

Syntax

CANCEL_UC_OBJECT (RUN# [, Extension])

Syntax

Description/Format

Run#

Run number of the activated object
Format: script literal or script variable

Extension

This additional parameter is available for specific object types.
Format: AE name or script literal

  • For events:

    You can specify a status for an Event object on which it will then be ended.


    Allowed values:
    "ENDED_OK"
    "ENDED_CANCEL"
    "ENDED_TIMEOUT"
  • For Workflow, Schedule and Group objects:

    The parameter "ALL" causes that all running subordinated tasks in workflow, Schedule and Group objects are also canceled.

    Allowed value:
    "ALL"

Return codes

"0" - Task was canceled successfully
"11049" - Task with this RUN# was not found and therefore not canceled
"11050" - The task has a status that cannot be canceled
"20347" - It is not possible to cancel a script with CANCEL_UC_OBJECT when it was started via a CallAPI

Comments

The execution of activated objects can be canceled with  the statement CANCEL_UC_OBJECT. Activated objects can be accessed using the Short Label of the object type and the run number with which the object has been activated.

The script statement :ON_ERROR can be used to determine the reaction to this error which can then be analyzed with the Script Functions for Error Handling. Script processing is continued but can also be canceled if necessary.

Keep the following in mind for events: a new instance of the activated event is created whenever an event occurs. This instance has also a run number. If the event should be terminated due to specified conditions that occurred, the RUN# can be retrieved with the function SYS_ACT_PARENT_NR.

The script statement causes all open transactions of the script to be written to the AE database.

In previous releases, the CANCEL_UC_OBJECT script function could be used for ended tasks to triggered a deactivation. This is not possible any more. Now you need to use the DEACTIVATE_UC_OBJECTscript function instead.

Examples

In the example, the notification "ALARM3" is activated. The statement :READ is used to wait until the notification is displayed. After retrieving the run number and the confirmation of the user, the notification is terminated.

:SET &JOBNR# = ACTIVATE_UC_OBJECT("ALARM3")
:
READ &JOBNR#,,,&JOBNR#
:
SET &STATUS# = CANCEL_UC_OBJECT(&JOBNR#)

The example shows part of the script of an event. When the event occurs, the run number is retrieved and the event is terminated.

:SET &JOBNR# = SYS_ACT_PARENT_NR()   
:
SET &STATUS# = CANCEL_UC_OBJECT(&JOBNR#)

The following lines cancel a running Event object with the status "ENDED_CANCEL".

:SET &RUNNR# = GET_UC_OBJECT_NR(EVNT.NACHT)
:
SET &STATUS# = CANCEL_UC_OBJECT(&RUNNR#, "ENDED_CANCEL")

See also:

Script element Description

ACTIVATE_UC_OBJECT

Activates an object.

RESTART_UC_OBJECT Repeats the execution of a task.
GET_UC_OBJECT_NR Returns the RUN# of an activated object.
:ON_ERROR Determines the reaction to certain errors and messages of script elements.

Script Elements - Activate Objects

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by function