Author Topic: Using "globaltextreplace" command  (Read 3870 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
Using "globaltextreplace" command
« on: August 21, 2017, 05:33:46 PM »
Purpose:
The "globaltextreplace" command replaces user-specified text throughout an SAP environment.
This command can be used either to perform the replacement on all screens, or users can specify screens that can
be either included or excluded from the replacement process.
Please note that if you are replacing a hex number, you must isolate the term by preceding it with the caret mark (^).

NOTE:
You must have the "wsoffice.dll" loaded in order to use this command.
Also recommend using this command in the 'esession.sjs' script file.

Syntax:
// In case of Single Screen
globaltextreplace(/TextToBeReplaced/,'ReplacementText',{"ocx":true, "listscreen":false,"screen":"DynProName"});

// In case of Multiple Screens
globaltextreplace(/TextToBeReplaced/,'ReplacementText',{"ocx":true, "listscreen":false,"screen":["DynProName1","DynProName2"]});
[OR]
globaltextreplace(/TextToBeReplaced/,'ReplacementText',{"ocx":true, "listscreen":false});

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
load("wsoffice.dll");

// Function for Single Screen Global Text Replace
function z_globalTextReplace_singleScreen(){
   onscreen "SAPMV45A.0102"
      globaltextreplace(/Order/, 'Request', {"ocx":true, "listscreen":false, "screen":["SAPMV45A.0102"]});
      enter("?");
}

// Function for Multi Screen Global Text Replace [Do not specify "screen" option]
function z_globalTextReplace_multiScreen(){
   onscreen "SAPMV45A.0102"
      globaltextreplace(/Order/, 'Request', {"ocx":true, "listscreen":false});
      enter("?");
}

// User Interface
pushbutton([TOOLBAR], "GTR - Single Screen", "/nVA02", {"process":z_globalTextReplace_singleScreen});
pushbutton([TOOLBAR], "GTR - Multi Screen", "/nVA02", {"process":z_globalTextReplace_multiScreen});


See attachments for code samples!

« Last Edit: August 25, 2017, 10:19:34 AM by Benjamin Dasari »