Author Topic: Liquid UI "reenter" Command  (Read 4895 times)

Sabir Mohammad

  • Administrator
  • Newbie
  • *****
  • Posts: 52
    • View Profile
Liquid UI "reenter" Command
« on: March 29, 2018, 10:58:41 AM »
Purpose:
To prompt for user actions within SAP screens and nest the process functions to reuse them. The maximum nested level is 8.

Pre-Requisites:
1. Liquid UI WS.
2. Liquid UI WS Server version 3.5.570.0 & above. (if accessing scripts via WS Server)

Usage:
To trigger a process function using parameters. This command is often used in conjunction with the "onscreen" and "onUIEvents" commands. The perfect use case for "reenter" is "MessageBox" command in LUI Server.

Syntax:
reenter('tcode',{process: functionname, using:{parameter:value}});

Options:
fcode/tcode: Passing SAP transaction code.
process: Calls a function.
using: Passing values to processes.

Liquid UI Code:
Below code demonstrates the usage on SAP Easy Access Screen.
----------------------------SAPLSMTR_NAVIGATION.E0100.sjs-----------------------

//deleting controls on easy access screen
del("P[User menu]");
del("P[SAP menu]");
del("P[SAP Business Workplace]");
del("P[Display role menu]");
del("P[Add to Favorites]");
del("P[Create role]");
del("P[Assign users]");
del("P[Documentation]");
del("X[Image_container]");
del("P[Delete Favorites]");
del("P[Change Favorites]");
del("P[Move Favorites down]");
del("P[Move Favorites up]");

//Creating toolbar pushbutton
pushbutton([TOOLBAR],"Test Reenter","?",{"process":executeFnMessageboxbuttons});
function executeFnMessageboxbuttons ()
{
onscreen 'SAPLSMTR_NAVIGATION.0100'
enter('/nva01');
onscreen 'SAPMV45A.0101'
enter('/nmm01');

onscreen 'SAPLMGMM.0060'
println('Calling MessageBox and wait for user.\n\n');
reenter({process:procLUImessagebox_1, using:{title:'This is the title of messagebox', message:'THis is the message', type:MB_YESNO}});
       
onscreen 'SAPLMGMM.0060'
println('Continuing execution after reenter!!!......');
println('_eventid=*'+system.stringify(_eventid)+'*');
switch(_eventid)
{
   case 'YES':
println('\nUser Clicked YES');
break;
   case 'NO':
println('\nUser Clicked NO');
break;
}
println('_last_fcode: '+_last_fcode+'\n\n');
enter('/15');

onscreen 'SAPLSMTR_NAVIGATION.0100'
println('Second Event on first process continues.....');
println('Calling MessageBox_2 and wait for user.\n\n');
reenter({process:procLUImessagebox_2, using:{title:'This is the title of messagebox', message:'THis is the message', type:MB_YESNO}});

onscreen 'SAPLSMTR_NAVIGATION.0100'                           
}
function procLUImessagebox_1(pUsing)
{
// when in reenter, this PREFC section gets executed FS
println('inside procLUImessagebox_1');
println('title=*'+pUsing.title+'*');         
enter('/o');
       
onscreen 'RSM04000_ALV_NEW.2000'
goto resize_repaint;

onscreen 'RSM04000_ALV.2000'
resize_repaint:;
println('onscreen RSM04000_ALV.2000 _eventid=*'+_eventid+'*\n\n');
clearscreen();
windowsize([5,5,50,8]);
title(pUsing.title);
//Draw the interface with buttons
switch(pUsing.type) {
   case MB_YESNO:
pushbutton([1,1],'Yes','/12',{'eventid':'YES'
pushbutton ([1,10],'No','/12',{'eventid':'NO'});
pushbutton ([1,15],'Not Text','/12',{'eventid':{val:45, str:'this is a long string', vbool:false}});
break;
}                     
}
function procLUImessagebox_2(pUsing)
{
// when in reenter, this PREFC section gets executed FS
println('inside procLUImessagebox_2');
println('title=*'+pUsing.title+'*');           
enter('/o');
onscreen 'RSM04000_ALV_NEW.2000'
goto resize_repaint;
onscreen 'RSM04000_ALV.2000'
resize_repaint:;
println('onscreen RSM04000_ALV.2000 _eventid=*'+_eventid+'*\n\n');
clearscreen();
windowsize([5,5,50,8]);
title(pUsing.title);
//Draw the interface with buttons
switch(pUsing.type) {
    case MB_YESNO:
pushbutton([1,1],'Yes','/12',{'eventid':'YES'});
pushbutton ([1,10],'No','/12',{'eventid':'NO'});
pushbutton ([1,15],'Not Text','/12',{'eventid':{val:45, str:'this is a long string', vbool:false}});
 break;
 }
 onscreen 'UNREACHABLE_PROGRAM.0000'
 enter();

 onscreen 'UNREACHABLE_PROGRAM.0000'
 enter();         
}