SapGuiGetString Function

Action

Retrieves the return value of the last SapGuiInvokeMethod call. A method invoked by SapGuiInvokeMethod may return a value, however this value is not returned by the SapGuiInvokeMethod call itself. Therefore you can use SapGuiGetString to get the return value of the invoked method. SapGuiGetString works on different return types, like String, numbers, Boolean. The values will be converted to a string.

Include file

SapGui.bdh

Syntax

SapGuiGetString( out sValue : string ): boolean;
Parameter Description
sValue Retrieves the return value of the last SapGuiInvokeMethod call

Return value

  • true if successful

  • false otherwise

Example

transaction TMain
  var
    sConnID, sValue : 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(2.8);
    SapGuiLogon("ddic", "minisap", "000", "");

    // SAP Easy Access
    ThinkTime(9.9);
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_Exact);
    SapGuiSetString("0000003");
    SapGuiInvokeMethod("/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "GetNodeKeyByPath");

    // Get the return value of the previous InvokeMethod
    SapGuiGetString(sValue);
  end TMain;