如何为SAP弹出窗口编写SAP GUI SCRIPT [英] How can I write SAP GUI SCRIPT for a SAP pop up window

查看:120
本文介绍了如何为SAP弹出窗口编写SAP GUI SCRIPT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望得到您的帮助,以便找到以下解决方案.我想将SAP标准发票提取为PDF文件.步骤为VF03-插入开票凭证-菜单:开票凭证-发货输出-选择行-打印预览-PDF!+,然后在下面出现弹出窗口.在弹出的窗口中,我想按保存"按钮,然后使用已复制到剪贴板的特定文件名保存文件.

I would like to have your help in order to find the solution for the following. I would like to extract SAP standard invoices to PDF files. The steps are VF03 - insert billing doc - Menu: Billing Document - Issue output - select the line - print preview - PDF! + and then I have the pop-up window below. In the pop up window I would like to press the 'SAVE button' and then save the file with specific filename, which I have already copied to clipboard.

代码如下

 SESSION.findById("wnd[0]").maximize
SESSION.findById("wnd[0]/tbar[0]/okcd").Text = "/NVF03"
SESSION.findById("wnd[0]").sendVKey 0
SESSION.findById("wnd[0]/usr/ctxtVBRK-VBELN").Text = invoice ' "1094542982"
SESSION.findById("wnd[0]/usr/ctxtVBRK-VBELN").caretPosition = 10
SESSION.findById("wnd[0]/mbar/menu[0]/menu[11]").Select
SESSION.findById("wnd[1]/usr/tblSAPLVMSGTABCONTROL").getAbsoluteRow(0).Selected = True
SESSION.findById("wnd[1]/tbar[0]/btn[37]").press
SESSION.findById("wnd[0]/tbar[0]/okcd").Text = "PDF!"
SESSION.findById("wnd[0]").sendVKey 0

推荐答案

我会尝试以下操作:

...
Set wshell = CreateObject("WScript.Shell")

n = 1
do
 bWindowFound = wshell.AppActivate("Save as")
 n = n + 1
 wscript.sleep 1000 
Loop Until bWindowFound or n > 10

if bWindowFound then
   wshell.SendKeys "myDocument.pdf"
   wscript.sleep 200
   wshell.SendKeys "{TAB 3}"
   wscript.sleep 200
   wshell.SendKeys "{ENTER}"
end if

关于ScriptMan

Regards, ScriptMan

这篇关于如何为SAP弹出窗口编写SAP GUI SCRIPT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆