Using HIDE_CURRENT_FORM to manage access to command handler tabs

RAMP-NL

Using HIDE_CURRENT_FORM to manage access to command handler tabs


In this scenario a RAMP application has been created over an order processing system.

Imagine that some of the command handler tabs (and their underlying 5250 destination scripts) need to prevent users from performing actions on cancelled or completed orders.   

Step 1 - Put some sort of "Code" or "Status" column into every instance list entry

Here field #ORDSTATUS is mapped into instance list column Acolumn9().

Imagine it contains values "CAN" (cancelled), "OPN" (Open), "WIP" (Being worked on) or "COM" (completed) ....    

  

Invoke Method(#avListManager.AddtoList) Visualid1(#OrdNo) Visualid2(#CustlName) Akey1(#OrderNumber) AColumn9(#ORDSTATUS)

  

Note: AColumn9() may or may not be shown to the user as desired.

  

Step 2 - Put checking code into the appropriate INVOKE scripts

Here the INVOKE script for a 5250 screen that allows an order to be modified has had a check added to stop people from trying to display cancelled or completed orders .....

 

/* Get the order status from additional column 9 in the current order instance list entry */

  

var ORDSTATUS = objListManager.AColumn9[0];

 

/* If the order is cancelled or closed, prevent the 5250 screen from being displayed, and show a message as to why */

  

if ((ORDSTATUS == "CAN") || (ORDSTATUS == "COM"))

{

   HIDE_CURRENT_FORM("Sorry, but you are not allowed to display this order because it is cancelled or completed.");

   return;

}

 

/* If we reach here then it's okay to proceed to the order display screen */

  

NAVIGATE_TO_JUNCTION("OrderMainMenu");

  

<etc>

<etc>

  

The HIDE_CURRENT_FORM("message") function causes the current 5250 screen being displayed on the command tab to be hidden and the message "Sorry, but you are not allowed to display this order because it is cancelled or completed." to appear in the center of the tab instead.

 The content of AColumn9 (ie: "CAN", "OPN", "WIP", "COM") could be used anywhere in INVOKE or BUTTON scripts to limit or control user activities.