Hello Sir, i am able to run the script but i am not able to extract the fields as they are non editable fields in sap.I will be grateful if you could guide me on how to extract particular fields from SAP to excel
That does not matter. Each field have a Caption or Text property which holds the current value even if it is read only. I have a tips & tricks video where I explain how you can find your fields in the watch list and see which property holds the value.
Uh, that is a tough question. I did a very quick test. I created a simple recording using FB50 where there is a status light. It is possible to click on that and it comes to focus, therefore the script has recorded that: session.findById("wnd[0]/usr/txtRF05A-AMPEL").setFocus. You can put this into your Excel, put a breakpoint here, and add session.findById("wnd[0]/usr/txtRF05A-AMPEL") to the watch. You should see all the properties this object has and see which one has a value which represents the green/amber/red state.
Thanks for the useful information ! I've noticed that even though it is faster than a person, SAPGUI scripts run kinda slow, probably due to long response times. Would you happen to know if SAP offers some other way of automating a task ? Like an API or something similar that doesn't rely on the GUI.
I am pretty sure that there are many different ways to connect to SAP. I only used GUI scripting and LSMW which is almost the same thing. I think if you need performance or volume you could use RFC or BAPIs (either standard or bespoke). That way you interact with SAP directly and not via a UI layer.
+Leonardo Alcantara I am glad you like it. It appears these GUI scripting with Excel seem to interest a few people. I will try to come up with a few more scenarios and package them as separate videos.
you can just reduce the size of the VBA window. another tip is that you can run the code line by line by pressing "F8", so you can see the code step by step on SAP or excel. it's easier to fix some errors
Hello sir, I hope you are doing well. In fact, I'm in a graduation internship and I'm totally stuck in an extraction method. I have an excel sheet that contains a set of components. My goal is to extract for each component the data found with transaction md04 using excel vba. It really takes a lot of time when i use the script that allows me to extract informations for every components. Do you have an idea about another method that can help me to reduce the time of the extract data ? Thank you very much.
Hi Csongor, I have a problem, excel is not pasting data from sap. Quick watch found the text all ok but it is not pasting it into excel. Any idea? Thank you sht.Cells(i, 2) = session.findById("wnd[1]/usr/ctxtRIPW0-MATNR").Text
I have exactly the same problem. When i run the script with a breakpoint and add this breakpoint to the "add watch" list it does not recognize the type as a SAP field. Therefore the result is that I cannot extend the field and choose another value that I would like to extract.
+Csongor Varga thx for share this video, but the script always show this error "No active session to system XXX or scripting is not enabled." how i get the SAP Active Session ?
Loving these videos. This is helping me automate a whole lot of stuff that used to be very painful. 1 thing i am stuck with. i need to look at table T439C passing in a 'Scope of Planning (PUWNR), and then the last Counter (PUCNT) and then add 1 to this value so i can then use the new number to input a new record. Any ideas appreciated?
Maybe you can create a script in SE16 with the output turned to ALV grid. Filter in PUWNR execute the query, sort descending on PUNCT and get the top value. It should not be complicated with an ALV grid.
worked it out. im extracting from sap to txt and then importing csv into another tab, then using "=LOOKUP(2,1/(planningScope!E:E""),planningScope!E:E)+1" to find the last value and then adding one. Probably long winded but seems to work
Hello,First i wanna thank you for this great video. I had a problem with the connection part. i'm connected with the user session so i had always the same msg: "No active session to system XXX or scripting is not enabled" is that related to the fact that i'm connected with the user session??
The scripting functionality may not be enabled in your system. Watch the first video in the playlist or the trick and tips video, I talk about it there.
I think that the script works because when i pressed extract i had the msg that shows that SAP GUI is connected.. but the macro stoped in the interface of SAP.. wich mean that the code is not able to enter to the session even that my session was already opened :( . In the W_SYSTEM i entered the ID of my system. Is that correct? Thank you so much.. i'm really confused..
Well, you should have done everything as you said. You enter your SID and client in VBA here: W_System = "DCG210" (replace DCG210). That should work. If I could see your screen I would probably know more.
On monday morning i will send to you the screen of SAP interface ( wich shows the SID) and my code ( because i can't open my session now) . i'm really so grateful to you sir, i'm stocked here from tuesday and i need to complete my project as soon as possible. Thank you so much.
Hello sir,I sent to you ( you adress mail: csongor.varga@gmail.com) my code. I solved the problem of W_System but know i have another problem :( . My problem is that when i run the macro, i have the msg : error 91 object non défini.. i don't know where is exactly the problem .
Hi Varga, while I opened your template in excel I can see as missing Sap gui scripting API How can I enable this, if you don't mind can you please share your mail id
Hi Csongor, Thanks for such excellent video on data extraction directly from excel. Can we download expense gl data from code fs10n on similar lines ? If yes then please share video on that as well. Thanks.
Sir, you saved my team form an extense night of copying and pastying alot of information.
Hey Mr. Varga! Thanks in advance! You are incredible. You explains everything quite good, really easy to understand. U have just saved a lot of time!
Thanks a lot. you helped us to optimize our work pretty much... live long...
Hi im new to VBA, i always encounter complie error in Public Sub RunScript (Currentline) i cannot troubleshoot it
Hi, what is the error message?
sorry when "On error" mine stops and doesn't continue to the next line. What could it be?
Did you use "On error resume next". Otherwise it will stop.
Hi there good sir, for mass extraction I recommend to clear the memory at the end of VBA coding in the RunGUIScript function
Thanks for the tip.
Can any possible using VBA macro to place any online orders.
Great video, great code. Thank you.
Hello Sir, i am able to run the script but i am not able to extract the fields as they are non editable fields in sap.I will be grateful if you could guide me on how to extract particular fields from SAP to excel
That does not matter. Each field have a Caption or Text property which holds the current value even if it is read only. I have a tips & tricks video where I explain how you can find your fields in the watch list and see which property holds the value.
Hello,
Thank you for sharing all of this with everyone. Quick consult. Do you know how to close all downloaded files automatically?
What do you mean close downloaded file? Why would it be open?
I tried but it extracts the first line only and showing error "Run-time error 91. Object variable or with block variable not set"
Pls help me to solve this.
Did you check that in the VBA editor / Options / Preferences, the SAP GUI Scripting API is added (checked) in the list of references?
In case you need to extract a Status? not a field, the status, if is green, yellow or gree, it is posible? thanks!
Uh, that is a tough question. I did a very quick test. I created a simple recording using FB50 where there is a status light. It is possible to click on that and it comes to focus, therefore the script has recorded that: session.findById("wnd[0]/usr/txtRF05A-AMPEL").setFocus. You can put this into your Excel, put a breakpoint here, and add session.findById("wnd[0]/usr/txtRF05A-AMPEL") to the watch. You should see all the properties this object has and see which one has a value which represents the green/amber/red state.
Thanks for the useful information ! I've noticed that even though it is faster than a person, SAPGUI scripts run kinda slow, probably due to long response times. Would you happen to know if SAP offers some other way of automating a task ? Like an API or something similar that doesn't rely on the GUI.
I am pretty sure that there are many different ways to connect to SAP. I only used GUI scripting and LSMW which is almost the same thing. I think if you need performance or volume you could use RFC or BAPIs (either standard or bespoke). That way you interact with SAP directly and not via a UI layer.
Thank you very helpful and very well detailed I like your videos
+Leonardo Alcantara I am glad you like it. It appears these GUI scripting with Excel seem to interest a few people. I will try to come up with a few more scenarios and package them as separate videos.
Do you know how to create a PO using as reference a Purchasing requisition?
a question, how do you do it so that you see on the screen the excel, while working the macro? please
you can just reduce the size of the VBA window. another tip is that you can run the code line by line by pressing "F8", so you can see the code step by step on SAP or excel. it's easier to fix some errors
Hello sir,
I hope you are doing well. In fact, I'm in a graduation internship and I'm totally stuck in an extraction method. I have an excel sheet that contains a set of components. My goal is to extract for each component the data found with transaction md04 using excel vba. It really takes a lot of time when i use the script that allows me to extract informations for every components. Do you have an idea about another method that can help me to reduce the time of the extract data ?
Thank you very much.
You can make videos automatically import data from excel to SAP NetWeaver Portal
great!! thank you so much
how to get "W_System" ??
That is the SID for your system and the client. You find it in the status bar of your GUI when you are logged in.
@@csongorvarga Sir, not able to find this..c
Hi Csongor, I have a problem, excel is not pasting data from sap. Quick watch found the text all ok but it is not pasting it into excel. Any idea? Thank you
sht.Cells(i, 2) = session.findById("wnd[1]/usr/ctxtRIPW0-MATNR").Text
Hmm, can you try sht.Cells(i,2).Value = ...? Does your session.findById() function return the value you are after?
I have exactly the same problem. When i run the script with a breakpoint and add this breakpoint to the "add watch" list it does not recognize the type as a SAP field. Therefore the result is that I cannot extend the field and choose another value that I would like to extract.
+Csongor Varga thx for share this video, but the script always show this error "No active session to system XXX or scripting is not enabled." how i get the SAP Active Session ?
Do you have scripting enabled? Please watch my first video in this playlist, it has these details explained.
Loving these videos. This is helping me automate a whole lot of stuff that used to be very painful. 1 thing i am stuck with. i need to look at table T439C passing in a 'Scope of Planning (PUWNR), and then the last Counter (PUCNT) and then add 1 to this value so i can then use the new number to input a new record. Any ideas appreciated?
Maybe you can create a script in SE16 with the output turned to ALV grid. Filter in PUWNR execute the query, sort descending on PUNCT and get the top value. It should not be complicated with an ALV grid.
worked it out. im extracting from sap to txt and then importing csv into another tab, then using "=LOOKUP(2,1/(planningScope!E:E""),planningScope!E:E)+1" to find the last value and then adding one. Probably long winded but seems to work
Hello man, great videos, could you please put a link to the first video you mention ?
There is a link to the SAP GUI playlist in the video description.
@@csongorvarga thanks man!
Hello,First i wanna thank you for this great video. I had a problem with the connection part. i'm connected with the user session so i had always the same msg: "No active session to system XXX or scripting is not enabled" is that related to the fact that i'm connected with the user session??
The scripting functionality may not be enabled in your system. Watch the first video in the playlist or the trick and tips video, I talk about it there.
I think that the script works because when i pressed extract i had the msg that shows that SAP GUI is connected.. but the macro stoped in the interface of SAP.. wich mean that the code is not able to enter to the session even that my session was already opened :( . In the W_SYSTEM i entered the ID of my system. Is that correct? Thank you so much.. i'm really confused..
Well, you should have done everything as you said. You enter your SID and client in VBA here: W_System = "DCG210" (replace DCG210). That should work. If I could see your screen I would probably know more.
On monday morning i will send to you the screen of SAP interface ( wich shows the SID) and my code ( because i can't open my session now) . i'm really so grateful to you sir, i'm stocked here from tuesday and i need to complete my project as soon as possible. Thank you so much.
Hello sir,I sent to you ( you adress mail: csongor.varga@gmail.com) my code. I solved the problem of W_System but know i have another problem :( . My problem is that when i run the macro, i have the msg : error 91 object non défini.. i don't know where is exactly the problem .
Hi Varga, while I opened your template in excel I can see as missing Sap gui scripting API
How can I enable this, if you don't mind can you please share your mail id
It is sapfewse.ocx, it should be under program files, sap, frontend, sapgui folder. Just use the Browse button to add it manually.
Hi Csongor, Thanks for such excellent video on data extraction directly from excel. Can we download expense gl data from code fs10n on similar lines ? If yes then please share video on that as well. Thanks.
I am not doing videos on request. These videos show you how you can build a script for yourself.