Purpose
The reenter command prompts for user actions within SAP screens and nests the process functions to reuse them. The maximum nested level is 8.
You can use the reenter command 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 the reenter is the MessageBox scenario in LUI Server.
Changing nesting level
The most important concept to understand when does change in nesting level occur. There are 2 level changes, going deeper and going up.
To go deeper into the stack, i.e. to nest one level deeper, you will use the 'reenter' command, like:
Nesting level can be decreased in one of two ways:
- Graceful exit from the nested process function.
- Unable to find any onscreen, onerror, onmessage in the current process function.
Note: Beginning with Server release 3.5.570.0, the reenter() command is supported on Liquid UI Server.
Syntax
reenter(‘tcode’,{process:functionname,using:{parameter:value}});
Available Options
You can use the following options with the pushbutton:
You can pass an SAP transaction code to the reenter command. |
|
Calls a function. |
|
"using":{"param1":"value","param2":"value"…} - Passes values to processes. |
Example
Calling a function
To enable the process function to nest into another process function, you can use "reenter" command as shown below:
- Open the SAP Easy Access screen, click the Test Reenter toolbar pushbutton. You can find a MessageBox opened and wait for your input to proceed to the next process. Click the Yes/No/Not text button as per your requirement.
- You will see the action performed on the MessageBox is displayed in the console window.
Script Details
SAPLSMTR_NAVIGATION.E0100.sjs
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(); }