on 2018 Jul 10 8:31 AM
Hey, i am currently working on a vba code to extract a table from sap to excel. This works already really fine but the table does not contain every parameter i would like to have. So after the extraction, which also contains the material number, i want to add things like price, company etc. I already recorded a script but its not fully working.
Sub Price()
'setting the connection with sap:
Dim App, Connection, session As Object
Dim NetPrice As Object
Set SapGuiAuto = GetObject("SAPGUI")
Set App = SapGuiAuto.GetScriptingEngine
Set Connection = App.Children(0)
Set session = Connection.Children(0)
'launch a transaction
session.FindById("wnd[0]").Maximize
session.FindById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00012"
session.FindById("wnd[0]/usr/ctxtIF_MATNR-LOW").Text = "2157403"
session.FindById("wnd[0]/tbar[1]/btn[8]").press
session.FindById("wnd[0]/usr/lbl[16,9]").SetFocus
'This is the code my internet research provided
Net_Price = session.FindById("wnd[0]/usr/lbl[16,9]")
session.FindById("wnd[0]/usr/lbl[16,9]").caretPosition = 10
session.FindById("wnd[0]").sendVKey 2
session.FindById("wnd[0]/usr/txtEINE-NETPR").SetFocus
session.FindById("wnd[0]/usr/txtEINE-NETPR").caretPosition = 10
'exit
session.FindById("wnd[0]/tbar[0]/btn[3]").press
session.FindById("wnd[0]/tbar[0]/btn[3]").press
session.FindById("wnd[0]/tbar[0]/btn[3]").press
So at first i get into the right Transaction After that i fill in the Material number that i already have extracted to excel->here it is "2157403". After that i examine and get to a new sheet where i can see the Price. Since i can't chose copy and ctrl + y doesnt get recorded i need to find another way to copy that value and import it to excel. My Google research only gave me this result which occurs an error saying: "Runtime Error 619: The control could not be found by id.", everytime i try to run it..
Maybe you have an idea or can help me in any way? I would be really thankful! Best regards, Leon
Request clarification before answering.
User | Count |
---|---|
75 | |
21 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.