SapGuiSetFileName Function

Action

Sets a file name that will be used to replace the next file selection using the Windows function GetOpenFileName.

Include file

SapGui.bdh

Syntax

SapGuiSetFileName( in  sFileName : string allownull ): boolean;
Parameter Description
sFileName The file name to be used.

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    sId : string;
  begin
    // Connecting to SAP
    sId := SapGuiOpenConnection(" /SAP_CODEPAGE=1100 /FULLMENU lab77 00 /3");

    SapGuiSetActiveConnection(sId);

    SapGuiSetActiveSession("ses[0]");

    // SAP
    SapGuiSetActiveWindow("wnd[0]", "SAP", SAPGUI_MATCH_Exact);

    SapGuiWindowResize(117, 28, false);

    // Logon to SAP System
    // Before running a test you have to customize the password parameter!
    ThinkTime(5.3);
    SapGuiLogon("bcuser", "*******", "000", "");

				…

    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    ThinkTime(2.9);
    SapGuiSetFileName("C:\\Temp\\file.text");
    SapGuiPressButton("tbar[1]/btn[39]", "SapGuiPressButton\\btn[39]");
    // StatusBar(Msg/Id/Type/No): Attachment created/98314464/S/182

				…

    // Log Off
    SapGuiSetActiveWindow("wnd[1]", "Log Off", SAPGUI_MATCH_Exact);

    // Yes
    SapGuiPressButton("usr/btnSPOP-OPTION1", "Yes");
  end TMain;