Sets the text for a SapGui OK text field. These text fields are normally used to execute a SAP transaction.
SapGui.bdh
SapGuiSetOKCode( in sControlId : string allownull, in sOKCode : string, in sTimer : string optional ) : boolean;
Parameter | Description |
---|---|
sControlId | The id of the Ok textfield. |
sOKCode | Text to be set for the ok textfield. Normally, this will be the name of a SAP transaction. |
sTimer | Timer name used for measurements. |
transaction TMain
var
sConnId : string;
begin
// Connecting to SAP
sConnID := SapGuiOpenConnection(" /SAP_CODEPAGE=1100 /FULLMENU 10.5.2.198 0 /3");
SapGuiSetActiveConnection(sConnID);
SapGuiSetActiveSession("ses[0]");
// SAP
SapGuiSetActiveWindow("wnd[0]", "SAP", SAPGUI_MATCH_Exact);
SapGuiWindowAction(SAPGUI_WND_MAXIMIZE);
// Logon to SAP System
// Before running a test you have to customize the password parameter!
SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
ThinkTime(3.0);
SapGuiLogon("ddic", "*******", "000", "");
// Copyright
SapGuiSetActiveWindow("wnd[1]", "Copyright", SAPGUI_MATCH_Exact);
SapGuiPressButton("tbar[0]/btn[0]");
// SAP Easy Access
ThinkTime(7.1);
SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_Exact);
SapGuiSetOKCode("tbar[0]/okcd", "rz11");
SapGuiSendVKey(SAPGUI_VKEY_ENTER);
// Maintain Profile Parameters
SapGuiSetActiveWindow("wnd[0]", "Maintain Profile Parameters", SAPGUI_MATCH_Exact);
end TMain;