Liquid UI - WS Reference Library

System Variable: _pageexists in Dynamic Readonly Status Handling


Purpose

The example is to change readonly status for creating elements between Create/Change/Display transactions.
Those transactions will load same script according to the same screen number and screen name.
In order to create multiple commands for different readonly status of elements, this can save amount of scripts in large screen modification efficiently.

Below example uses IW31 - Create Maintenance Order/IW32 - Change Maintenance Order/IW33 - Display Maintenance Order as example.
The script merges some fields from "Location" tab to "HeaderData" tab so user don't need to go to extra tab to enter data.
It demonstrates how created inputfields can change its readonly status dynamically according to correspond conditions.


User Interface

IW31 – Create Maintenance Order


IW32 – Change Maintenance Order, Initial Screen


IW32 – Change Maintenance Order


IW33 – Display Maintenance Order, Initial Screen


IW33 – Display Maintenance Order



Liquid UI Script

//SAPLCOIH.E0101.sjs

// Author: Synactive, Inc. [1065 E. Hillsdale Blvd, Foster City, CA, 94404, USA]
// Email: support@guixt.com; sales@guixt.com;
// Contact: 650.341.3310
// Version: 1.0.0.0
//User Interface
onUIEvents["Enter"] = {"fcode":"?", "process":iw32iw33Execute};        //Execute when user hits enter on screen

//Function to execute and fetch data from "Location" tab
function iw32iw33Execute(){
    onscreen "SAPLCOIH.0101"
        enter();
        onmessage                    //Error handling
            if(_message.substring(0,2) == "E:"){
                message(_message);
                enter("?");
                goto FUNC_END;
            }
            else
                enter();
                
    onscreen "SAPLCOIH.0101"        //Error Handling
        if(_message.substring(0,2) == "E:"){
            message(_message);
            enter("?");
            goto FUNC_END;
        }
        else
            enter();

    onscreen "SAPLCOIH.3000"
        set("V[iw3x_status]", "&F[Sys.Status]");
        enter("=ILOA");            //Go to "Location" tab
        
    onscreen "SAPLCOIH.3000"
        set("V[iw3x_maint_plant]", "&F[MaintPlant]");
        set("V[iw3x_location]", "&F[Location]");
        set("V[iw3x_room]", "&F[Room]");
        set("V[iw3x_plant_section]", "&F[Plant section]");
        set("V[iw3x_work_center]", "&F[Work center]");
        enter("=IHKZ");            //Go to "HeaderData" tab
        
FUNC_END:;        
}

//SAPLCOIH.E3000.sjs

// Author: Synactive, Inc. [1065 E. Hillsdale Blvd, Foster City, CA, 94404, USA]
// Email: support@guixt.com; sales@guixt.com;
// Contact: 650.341.3310
// Version: 1.0.0.0
//User Interface

//If transaction is IW31 or IW32 but system status doesn't contain "CLSD"
if(_transaction == "IW31" || (_transaction == "IW32" && iw3x_status.indexOf("CLSD")<0)){
    iw3x_readonly_flag = false;
}
//If transaction is IW33 or system status contains "CLSD"
else if(_transaction == "IW33" || iw3x_status.indexOf("CLSD")>-1){
    iw3x_readonly_flag = true;
}

del("P[Location]");                    //Remove "Location" tab on screen

if(_page.exists("HeaderData")){
    box("G[First operation]+[6,0]", "G[First operation]+[10,80]", "Location");
    inputfield("G[Location]+[1,1]", "MntPlant", "G[Location]+[1,12]",
        {"name":"iw3x_maint_plant", "size":4, "readonly":iw3x_readonly_flag});
    inputfield("G[Location]+[2,1]", "Location", "G[Location]+[2,12]",
        {"name":"iw3x_location", "size":10, "readonly":iw3x_readonly_flag});
    inputfield("G[Location]+[3,1]", "Room", "G[Location]+[3,12]",
        {"name":"iw3x_room", "size":8, "readonly":iw3x_readonly_flag});
    inputfield("G[Location]+[1,41]", "Plant section", "G[Location]+[1,57]",
        {"name":"iw3x_plant_section", "size":3, "readonly":iw3x_readonly_flag});
    inputfield("G[Location]+[2,41]", "Work center", "G[Location]+[2,57]",
        {"name":"iw3x_work_center", "size":8, "readonly":iw3x_readonly_flag});
}

if(!iw3x_readonly_flag){
    onUIEvents["/11"] = {"fcode":"?", "process":iw3xSave};        //Execute when user hits save on screen
}