Script Function: This is used to terminate an activated object
CANCEL_UC_OBJECT(RunID, [Extension])
Syntax |
Description/Format |
---|---|
RunID |
Run number of the activated object |
Extension |
This additional parameter is available for specific
object types.
|
Return codes |
---|
"0" - Task was canceled successfully |
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 databaseA database is an organized collection of data including relevant data structures..
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.
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 |
---|---|
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