【SAP】windowsでのSAPのマニュアル監視
スポンサーリンク
監視ソフトが入れれないっていうとき仕込んでおきたいいくつかの施策。
■その1 バックグラウンドでログイン(要 ActiveX)
以下のVBSでファイルを作って定期的に実行
'①R/3インスタンス生成
Set R3 = CreateObject("SAP.Functions")
'②R/3ログオン情報記述(サイレントモードのみ)
Set oConnection = R3.Connection
oConnection.Applicationserver = "hostname" 'R/3IPアドレス
oConnection.Client = "000" 'クライアント
oConnection.user = "username" 'ユーザー名
oConnection.password = "password" 'パスワード
'③R/3ログオン( True→falseにするとポップアップでログオン情報入力)
If oConnection.logon(0, True) <> True Then
MsgBox "ログオンに失敗しました。再処理して下さい。"
End If
oConnection.logoff参照:http://homepage3.nifty.com/designer/html/saptech_dt04.html
SAP ActiveXコントロールを利用したエクセルアプリケーションの構築 Pert1データ抽出編
■その2 sapinfo.exe でリターンコードで判断
sapinfo ashost=hostname sysnr=nn
hostname : インスタンスのコンピュータ名
nn : インスタンス番号
RFCSDKに含まれるexeのようです。
■その3 vbsでsapdisp+workのプロセス数のカウント
Option Explicit
'WMIにて使用する各種オブジェクトを定義・生成する。
Dim oClassSet
Dim oClass
Dim oLocator
Dim oService
Dim sMesStr
'ローカルコンピュータに接続する。
Set oLocator = WScript.CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocator.ConnectServer
'クエリー条件をWQLにて指定する。
Set oClassSet = oService.ExecQuery("Select * From Win32_Process")
Dim cnt
cnt = 0
'コレクションを解析する。
For Each oClass In oClassSet
if oClass.Description = "disp+work.exe" then
cnt=cnt + 1
end if
Next
Wscript.Echo "disp+work.exeは" & cnt &"個です。"
'使用した各種オブジェクトを後片付けする。
Set oClassSet = Nothing
Set oClass = Nothing
Set oService = Nothing
Set oLocator = Nothing