on 07-17-2015 6:37 PM
Hello
I'm creating a software base on excel VBA to control some variable cost that are not tracked on our SAP.
I'm stuck in a problem were I need to import some information for the SAP to the base sheet on excel. I need to creat a VBA code to login my SAP open a transition for exemplo "MB51" add filters and export the result directly to the last empty line on my sheet.
Until now I can login ta SAP run the transition with the filters and show the results, but I can't export the results form SAP to my base sheet, can same one help me me ?
Public Sub SimpleSAPExport()
Set SapGuiAuto = GetObject("SAPGUI") 'Get the SAP GUI Scripting object
Set SAPApp = SapGuiAuto.GetScriptingEngine 'Get the currently running SAP GUI
Set SAPCon = SAPApp.Children(0) 'Get the first system that is currently connected
Set session = SAPCon.Children(0) 'Get the first session (window) on that connection
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00007"
session.findById("wnd[0]/usr/ctxtCHARG-LOW").Text = "4552872B"
session.findById("wnd[0]/usr/ctxtBWART-LOW").Text = "101"
session.findById("wnd[0]/usr/txtMJAHR-LOW").Text = "2000"
session.findById("wnd[0]/usr/txtMJAHR-HIGH").Text = "2015"
session.findById("wnd[0]/usr/ctxtALV_DEF").Text = "/CPS"
session.findById("wnd[0]/usr/ctxtALV_DEF").SetFocus
session.findById("wnd[0]/usr/ctxtALV_DEF").caretPosition = 4
session.findById("wnd[0]/tbar[1]/btn[8]").press
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.