Skip to content

General Element Set Actions

sapSetFocus

Since: 3.0

Description: Set focus on element.

Input Format: None

ObjectName Action Input Condition Reference
SAP 🟢 sapSetFocus ⬅ No Input
@Action(object = ObjectType.SAP, desc = "Set focus on [<Object>]", input = InputType.NO)
public void sapSetFocus() {
    try {
        Dispatch.call(SAPelement, "setFocus");
        Report.updateTestLog(Action, "Focus set on element", Status.DONE);
    } catch (Exception e) {
        Report.updateTestLog(Action, "Failed to set focus. Error: " + e.getMessage(), Status.FAILNS);
    }
}

sapSetObjectProperty

Since: 3.0

Description: Set object property at runtime.

Input Format: property value of SAP object

ObjectName Action Input Condition Reference
SAP 🟢 sapSetObjectProperty @value ⬅ Hardcoded Input
SAP 🟢 sapSetObjectProperty Sheet:Column ⬅ Input from Datasheet
SAP 🟢 sapSetObjectProperty %dynamicVar% ⬅ Input from variable
@Action(object = ObjectType.SAP, desc = "Set object [<Object>] property as [<Data>] at runtime", input = InputType.YES, condition = InputType.YES)
public void sapSetObjectProperty() {
    if (!Data.isEmpty()) {
        if (Condition.isEmpty()) {
            String[] groups = Data.split(",");
            for (String group : groups) {
                String[] vals = group.split("=", 2);
                setProperty(vals[0], vals[1]);
            }
        } else {
            setProperty(Condition, Data);
        }
        String text = String.format("Setting Object Property for [%s] with [%s] for Object [%s - %s]", Condition, Data,
                Reference, ObjectName);
        Report.updateTestLog(Action, text, Status.DONE);
    } else {
        Report.updateTestLog(Action, "Input should not be empty", Status.FAILNS);
    }
}

sapSetCurrentCell

Since: 3.0

Description: Set current table cell.

Input Format: row,column

ObjectName Action Input Condition Reference
SAP 🟢 sapSetCurrentCell @value ⬅ Hardcoded Input
SAP 🟢 sapSetCurrentCell Sheet:Column ⬅ Input from Datasheet
SAP 🟢 sapSetCurrentCell %dynamicVar% ⬅ Input from variable
@Action(object = ObjectType.SAP, desc = "Set current table cell [<Data>] (format: row,column)", input = InputType.YES)
public void sapSetCurrentCell() {
    try {
        String[] parts = Data.split(",");
        int row = Integer.parseInt(parts[0]);
        int col = Integer.parseInt(parts[1]);
        Dispatch.call(SAPtable, "SetCurrentCell", row, col);
        Report.updateTestLog(Action, "Current cell set to row [" + row + "], column [" + col + "]", Status.DONE);
    } catch (Exception e) {
        Report.updateTestLog(Action, "Failed to set current cell. Error: " + e.getMessage(), Status.FAILNS);
    }
}