由于某种原因,日报表需要导出为EXCEL文件,放到一个地方供某些人看。
如何自动执行这些报表?
后台运行不可行,ole不能在后台运行;
使用外部程序调用报表RFC也不可行;
最后选择sapScript。
不需要输入用户名、密码,自动登陆R3
1. 配置sapScript
设置参数sapgui/user_scripting = TRUE
2. 配置sap自动登录
1) 激活GuiXT
2) 创建文件logon.txt:
if V[_database=DEV]
Set F[RSYST-MANDT] "300"
Set F[RSYST-BNAME] "USERNAME"
Set F[RSYST-BCODE] "xxx"
Set F[RSYST-LANGU] "ZH"
Enter
Endif
3) 创建一个bat文件:
C:
cd C:\Program Files (x86)\SAP\FrontEnd\SAPgui
guixt.exe visible
exit
以上两个文件同存一个目录,如d:\sapscript
4) 运行bat,打开GUIXT,
On the GuiXT Profile window do:
1. Make sure the path C:\guixt\scripts is on the scripts 1 box
2. Select the start window “Hidden” check box.
3. Select the further options “No language key in script. file name” check box
4. Save the setting by clicking on “OK” button
3.录制脚本,可以看sap有关文档,比较简单的。
4.编写外部程序
定时执行下列命令
SAPGUI hostname sid ****执行命令
***停留一段时间,直到GUI启动
Wscript.exe **script.vbs. ***运行脚本
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26168649/viewspace-707955/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26168649/viewspace-707955/