Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
stefan_schnell
Active Contributor
0 Kudos
SAP offers an information control module with the SAP GUI for Windows, called SapInfo OLE Control Module. The filename of the module is sapfewin.ocx and the class name is Sapgui.InfoCtrl.1. This module contains a few functions to get some information, e.g. the Windows system path, the temporary directory, the desktop directory and and and... Often the functions are equivalent to the Windows API functions. In some cases it could be very helpful to know, that this library with this possibilities exists. On the one hand it is possible to use it inside your ABAP code and on the other hand it is possible to use it with SAP GUI Scripting. In the following VBS code I will demonstrate how to use some functions of the SapInfo OLE Conrol Module.
'-Begin-----------------------------------------------------------------

'-Directives----------------------------------------------------------
Option Explicit

'-Sub Main------------------------------------------------------------
Sub Main()

'-Variables-------------------------------------------------------
Dim SAPInfo, strResult, numResult

Set SAPInfo = CreateObject("Sapgui.InfoCtrl.1")
If IsObject(SAPInfo) Then

SAPInfo.AboutBox

strResult = SAPInfo.GetWindowsDirectory()
MsgBox strResult, vbOkOnly, "Windows directory"

strResult = SAPInfo.GetSystemDirectory()
MsgBox strResult, vbOkOnly, "System directory"

strResult = SAPInfo.GetComputerName()
MsgBox strResult, vbOkOnly, "Name of the computer"

strResult = SAPInfo.GetUserName()
MsgBox strResult, vbOkOnly, "Name of the user"

strResult = SAPInfo.GetWindowsVersion()
MsgBox strResult, vbOkOnly, "Windows version"

strResult = SAPInfo.GetTempPath()
MsgBox strResult, vbOkOnly, "Path for temporary files"

strResult = SAPInfo.GetDesktopDirectory()
MsgBox strResult, vbOkOnly, "Desktop directory"

strResult = SAPInfo.GetSapWorkDir()
MsgBox strResult, vbOkOnly, "SAP Work Directory"

numResult = SAPInfo.RegisterServer("C:\Dummy\Test.dll")
MsgBox CStr(numResult), vbOkOnly, "Server registered?"

numResult = SAPInfo.UnregisterServer("C:\Dummy\Test.dll")
MsgBox CStr(numResult), vbOkOnly, "Server unregistered?"

numResult = SAPInfo.MessageBox("MessageBox", "Title", 2, 2)
MsgBox CStr(numResult), vbOkOnly, "MessageBox result"

Set SAPInfo = Nothing
End If

End Sub

'-Main----------------------------------------------------------------
Main

'-End-------------------------------------------------------------------

 

Now the full list of all methods from the SAP Info Control Module
Call AboutBox ()
Call BrowseForFolder (Title As WString, InitDir As WString) As WString
Call ClipboardExport () As Integer
Call ClipboardImport () As Long
Call CreateDirectory (Directory As WString) As Integer
Call CreateScreenshot () As WString
Call DeleteFile (File As WString) As Integer
Call DeleteRegKey (Root As Integer, Key As WString) As Integer
Call DeleteRegValue (Root As Integer, Key As WString, _
Value As WString) As Integer
Call DirectoryExists (DirectoryName As WString) As Long
Call DisableHistoryForField (field_name As WString, _
disable_b As Integer) As Integer
Call Exec (CmdLine As WString, CmdShow As Long) As Integer
Call FileCopy (Source As WString, Destination As WString, _
mode As Integer) As Integer
Call FileExists (file_name As WString) As Long
Call FileOpenDialog (CaptionAs WString, DefExt As WString, _
File As WString, Filter As WString, InitDir As WString, _
bMultiSelection As Integer) As Integer
Call FileOpenDialogEx (Caption As WString, DefExt As WString, _
File As WString, Filter As WString, InitDir As WString, _
bWithEncoding As Integer, multiselection As Integer) As Integer
Call FileSaveDialog (Caption As WString, DefExt As WString, _
File As WString, Filter As WString, InitDir As WString) As WString
Call FileSaveDialogEx (Caption As WString, DefExt As WString, _
File As WString, Filter As WString, InitDir As WString, _
bWithEncoding As Integer, bOverwriteonprompt As Integer) As WString
Call GetComputerName() As WString
Call GetCurrentDirectory () As WString
Call GetDesktopDirectory () As WString
Call GetDownloadPath () As WString
Call GetDriveType (Drive As WString) As WString
Call GetEnvVariable (Variable As WString) As WString
Call GetFileAttribute (FileName As WString, Attribute As Integer) _
As Integer
Call GetFileInfo (File As WString, Info As Integer) As WString
Call GetFileSize (File As WString) As Long
Call GetFreeSpaceForDrive (Drive As WString) As Long
Call GetFreeSpaceForDriveEx (lpDirectoryName As WString) As WString
Call GetFullPathName (File As WString) As WString
Call GetGuiFeatures () As WString
Call GetGuiVersion () As Long
Call GetIPAddress () As WString
Call GetPlatformEx () As Long
Call GetProfileString (File As WString, Section As WString, _
Key As WString) As WString
Call GetProgramName () As WString
Call GetProgramPath () As WString
Call GetRegDWValueEx (Root As Integer, Key As WString, _
Value As WString) As Long
Call GetRegValue (Root As Integer, Key As WString) As WString
Call GetRegValueEx (Root As Integer, Key As WString, Value As WString) _
As WString
Call GetSapGUIDirectory () As WString
Call GetSapWorkDir () As WString
Call GetSystemDirectory () As WString
Call GetTempPath () As WString
Call GetUploadPath () As WString
Call GetUserName () As WString
Call GetWindowsBuildNumber () As WString
Call GetWindowsDirectory () As WString
Call GetWindowsPlatform () As WString
Call GetWindowsVersion () As WString
Call GetWindowsVersionEx () As WString
Call IsScriptingActive () As Long
Call IsTerminalServicesRunning () As Integer
Call ListFiles (Directory As WString, Filter As WString) As Integer
Call MessageBox (Text As WString, Caption As WString, Icon As Long, _
Type As Long) As Long
Call RaiseScriptingEvent (params As WString) As WString
Call RegisterServer (Path As WString) As Long
Call RemoveDirectory (Directory As WString) As Integer
Call SetCurrentDirectory (Directory As WString) As Integer
Call SetEnvVariable (Variable As WString, Value As WString) As Integer
Call SetFileAttribute (FileName As WString, Normal As Integer, _
ReadOnly As Integer, Hidden As Integer, Archive As Integer) As Integer
Call SetFileDateTime (FileName As WString, wYear As Integer, _
wMonth As Integer, wDayOfWeek As Integer, wDay As Integer, _
wHour As Integer, wMinute As Integer, wSecond As Integer) As Integer
Call SetProfileString (File As WString, Section As WString, _
Key As WString, Value As WString) As Integer
Call SetRegDWValueEx (Root As Integer, Key As WString, _
Value As WString, Data As Long) As Integer
Call SetRegValue (Root As Integer, Key As WString, Value As WString) _
As Integer
Call SetRegValueEx (Root As Integer, Key As WString, Value As WString, _
Data As WString) As Integer
Call SetTimer (Interval As Long) As Long
Call ShellExecute (Operation As WString, File As WString, _
Parameters As WString, Directory As WString, ShowCmd As Long) As Long
Call ShellExecuteEx (Operation As WString, File As WString, _
Parameters As WString, Directory As WString, ShowCmd As Long, _
nSynchroneMode As Integer) As Long
Call ShowDocument (data_provider_URL As WString, data_length As Long, _
document_name As WString, mime_type As WString, keep_file As Long) _
As WString
Call UnregisterServer (Path As WString) As Long
Call WinHelp (HelpFile As WString, Command As Long, Data As Long) _
As Integer

There are many interesting methods which can simplify programming.
1 Comment
Labels in this area