Liquid UI Forum

Using Your Liquid UI Products => WS aka Web Scripts (Attended RPA for SAP) => Topic started by: Ashfaq Ahmed on July 06, 2020, 02:37:34 AM

Title: OnTCodeTerminate Event Handler.
Post by: Ashfaq Ahmed on July 06, 2020, 02:37:34 AM
Purpose:
OnTCodeTerminate is an Event Handler, which will trigger a function when an Exit Button is clicked/tapped from the transaction.

Syntax:
onTCodeTerminate[_transaction] = function(){
//Statements
-----------------;
-----------------;
}

Note:
OnTcodeTerminate Event Handler does not take any options.

Example:
Below example, executes the function, which resets the variable, on exiting the transaction.

Following are the Steps:

1. Create a script file "SAPMV45A.E0100.SJS" with the below code and save it in your WS scripts directory as configured in "guixt.sjs" file.

LIQUID UI script: SAPMV45A.E0100.SJS

VA01: Screen script
set("V[z_variable1]" , "1000"); //Initializing the variables
set("V[z_variable2]" , "2000");
println ("-----------Value of z_variable1 before clicking Exit Button is : " +z_variable1);
println ("-----------Value of z_variable2 before clicking Exit Button is : " +z_variable2);

onTCodeTerminate executing function
onTCodeTerminate[_transaction] = function (){
   set("V[z_*]",""); //Resetting the Variables
   message ("S: Variables are resetted");
   println ("-----------Value of z_variable1 after clicking Exit Button is : " +z_variable1);
   println ("-----------Value of z_variable2 after clicking Exit Button is : " +z_variable2);
}

Refer to the Attachment for Clarity...