我想在SAP中创建一个“输入字段”,它使用vb脚本中传递的值。为了给出一个具体的例子,我想要打开FBL5N,将发票传递到一个字段中,并在VF03中查看发票。执行此操作的脚本已准备就绪,并且适用于硬编码值invoice或通过VBA。
下面是GUI脚本部分
inputfield (2,35) "inv" (2,45) size=10 name="V_inv"
pushbutton (toolbar) "print_inv" process="InvoiceScript.txt"
using MYINV = "V_inv"现在,我不知道如何处理inputscript部分。我希望你能在这件事上提供帮助。这是我的第一次尝试:
Screen SAPLSLVC.0500
ApplyGuiScript template="VF03INV.vbs"
Enter感谢您的帮助,如果您需要任何精度,请告诉我。以下是我获得上述代码的灵感来源:http://www.synactive.com/tutor_e/lessonia03.html http://www.synactive.com/docu_e/docia_process2.html
*如果可以有一个版本来读取剪贴板中的值,那就更好了。
发布于 2017-01-17 09:33:19
经过多次尝试,下面是一个解决方案:
脚本(SAPLSLVC.0500.txt):
inputfield (2,35) "inv" (2,45) size=10 name="V_inv"
pushbutton (toolbar) "script" "/OVF03" process="startvf03.txt"
using INV = [V_inv] ' need this when opening new screenInputScript (startvf03.txt):
parameter INV
Screen SAPMV60A.0101 'this is the VF03 screen
SET F[VBRK-VBELN] "&U[INV]" 'pass invoice # parameter
ApplyGuiScript "C:\guiXT\scripts\VF03INV.vbs"VBScript (VF03INV.vbs):
inv = session.findById("wnd[0]/usr/ctxtVBRK-VBELN").text
session.findById("wnd[0]/mbar/menu[0]/menu[11]").Select
session.findById("wnd[1]/tbar[0]/btn[37]").press
session.findById("wnd[0]/tbar[0]/okcd").Text = "pdf!"
session.findById("wnd[0]").sendVKey 0
'with some little extra here on how to save a pdf in SAP
'get new strings for locations (specific to my situation)
abc = session.findById("wnd[1]/usr/cntlHTML/shellcont/shell").Browserhandle.locationURL
beg = instr(abc,"C:")
cde = mid(abc,beg,9999)
dest = "C:\111\invoices\" & inv & ".pdf"
'changing from temp to a specific folder
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.copyfile cde, dest
'close the open file
session.findById("wnd[1]").close
session.findById("wnd[0]").close
Set fso = nothing*你通常看到的几个If Not IsObject(application) Then是不必要的,但拥有它们并不会有什么坏处。
我希望这能帮助每个人学习Guixt。
发布于 2017-01-16 17:53:22
在VB脚本中,可以使用参数"template“来处理GuiXT变量,如下所示。
例如:
msgbox "&V[V_inv]"https://stackoverflow.com/questions/41669159
复制相似问题