执行一个事务后,我得到一堆用户ID,然后我将其复制并粘贴到事务的另一部分 我希望在VBA的帮助下做到这一点,但是" UIPOAD FROM CLIPBOARD"似乎不起作用。 有人可以帮忙吗?
设置SAPGUIAuto = GetObject(" SAPGUI")
Set SAPapplication = SAPGUIAuto.GetScriptingEngine
Set Connection = SAPapplication.Children(0)
Set session = Connection.Children(0)
session.findById(" WND [0]&#34)。最大化 session.findById(" wnd [0] / tbar [0] / okcd")。文字=" suim"
session.findById(" wnd [0]")。sendVKey 0
######第一部分######
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。expandNode" 02 1 2"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。topNode =" 01 1 1"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。expandNode" 03 2 7"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。selectItem" 04 2 8"," 1"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。ensureVisibleHorizontalItem" 04 2 8"," 1"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。topNode =" 01 1 1" session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。clickLink" 04 2 8"," 1"
session.findById(" WND [0]的/ usr / BTN% ACTGRPS % APP % - VALU_PUSH&#34)。按
session.findById(" wnd [1] / usr / tabsTAB_STRIP / tabpSIVA / ssubSCREEN_HEADER:SAPLALDB:3010 / tblSAPLALDBSINGLE / ctxtRSCSEL_255-SLOW_I [1,0]")。Text =" *******"
session.findById(" wnd [1] / usr / tabsTAB_STRIP / tabpSIVA / ssubSCREEN_HEADER:SAPLALDB:3010 / tblSAPLALDBSINGLE / ctxtRSCSEL_255-SLOW_I [1,1]")。Text =" ***********"
session.findById(" wnd [1] / usr / tabsTAB_STRIP / tabpSIVA / ssubSCREEN_HEADER:SAPLALDB:3010 / tblSAPLALDBSINGLE / ctxtRSCSEL_255-SLOW_I [1,2]")。Text =" ************"
session.findById(" WND [1]的/ usr / tabsTAB_STRIP / tabpSIVA / ssubSCREEN_HEADER:SAPLALDB:3010 / tblSAPLALDBSINGLE / ctxtRSCSEL_255-SLOW_I [1,2]&#34)。SetFocus的
session.findById(" wnd [1] / usr / tabsTAB_STRIP / tabpSIVA / ssubSCREEN_HEADER:SAPLALDB:3010 / tblSAPLALDBSINGLE / ctxtRSCSEL_255-SLOW_I [1,2]")。caretPosition = 18
session.findById(" WND [1] / TBAR [0] / BTN [8]&#34)。按 session.findById(" WND [0] / TBAR [1] / BTN [8]&#34)。按
session.findById(" wnd [0] / usr / cntlGRID1 / shellcont / shell / shellcont [1] / shell")。currentCellRow = -1
session.findById(" wnd [0] / usr / cntlGRID1 / shellcont / shell / shellcont [1] / shell")。selectColumn" BNAME"
#####获得一堆用户ID并在Ctrl + C的帮助下复制它######
session.findById(" WND [0] / TBAR [0] / BTN [3]&#34)。按 session.findById(" WND [0] / TBAR [0] / BTN [3]&#34)。按
######第二部分###### session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。expandNode" 02 1 10"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。topNode =" 01 1 1"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。selectItem" 03 3 1"," 1"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。ensureVisibleHorizontalItem" 03 3 1"," 1"
session.findById(" wnd [0] / usr / cntlTREE_CONTROL_CONTAINER / shellcont / shell")。clickLink" 03 3 1"," 1"
session.findById(" WND [0]的/ usr / BTN% USER % APP % - VALU_PUSH&#34)。按
session.findById(" WND [1] / TBAR [0] / BTN [24]&#34)。按 session.findById(" WND [1] / TBAR [0] / BTN [8]&#34)。按
在这里,我在第一部分复制用户ID并将其存储到BNAME中。 但是VBA无法从第二部分的剪贴板上传
也许是因为它不喜欢第一部分中的Ctrl + C
答案 0 :(得分:0)
您可以尝试以下方法:
'...
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").selectColumn "BNAME"
'---------------------- new -----------------------------------------
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").contextMenu
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").selectContextMenuItemByPosition "0"
'---------------------- new -----------------------------------------
'#####Got Bunch of User Ids and copied it with the help of Ctrl+C ######
'...