PDA

View Full Version : VBA to check for PR SAP attachment



Fiinguer
07-31-2019, 07:11 AM
Sub teste()

Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApplication = SapGuiAuto.GetScriptingEngine
Set SAPConnection = SAPApplication.Children(0)
Set session = SAPConnection.Children(0)


session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nme53n"
session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]").sendVKey 17
session.findById("wnd[1]/usr/subSUB0:SAPLMEGUI:0003/ctxtMEPO_SELECT-BANFN").Text = "Purchase Requisition"
session.findById("wnd[1]/usr/subSUB0:SAPLMEGUI:0003/ctxtMEPO_SELECT-BANFN").caretPosition = 8
session.findById("wnd[1]").sendVKey 0

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"
Set botao = session.findById("/app/con[0]/ses[0]/wnd[0]/titl/shellcont/shell/")

I need something like this:


attach = botao.CurrentContextMenu.Children.Item(2).isfocused


My Purchase Requisition has now attachment file, then I need to know if
the button "Attachment List" is avaiable to click or not.


REALLY need help with this, I am begging you.