Video není dostupné.
Omlouváme se.
SAP GUI Scripting 1 - Running scripts from Excel
Vložit
- čas přidán 14. 08. 2024
- This video covers SAP GUI Scripting basics, recording a script and running it from MS Excel using my example.
The Excel example shown in this video can be downloaded from:
drive.google.c...
Excel 2003 version of the code: drive.google.c...
All my GUI scripting files on Github (in case you cannot access the above link):
github.com/nyg...
If you like what I do here, you can support me with CZcams Thanks, or Patreon:
/ csongorvarga
Thank you so much.. This is very helpful and informative.
why is sap so complicated ?
@@trimerista So it can keep all the SAP consultants with jobs :)
@@csongorvarga hahaha
Varga, you are THE MAN. Very well explained. 2417 Task Lists released without breaking a sweat. Now to think what else this could be used for!
Just coming back to this to say that this video somewhat started my career for real
Thanks for this comment :)
I watch this without SAP yet for my new job that will start tomorrow. lols. but I do understand the execution and content. Very helpful. Thank you sir!
I've used your excel as a basis for a script I made. This saves us a lot of time. Thanks for sharing and taking your time to make such a deatiled video. Highly appreciated.
Thank you very very much for this. Very helpful. I edited your script for MM01-Material master data creation. Starting the script is saving my wrist pain 😊
Thank you very much ! It solved my problem to mass data load that was not working with LSMW. You have my subscription.
This is excellent and as relevant today as when Csongor took the effort to share. I've used SAP for some time but only very recently learned of this scripting functionality. Also playing with using Power Automate Flow (executing the SAP VB Scripts) & SAP scripting to effectively export SAP report data to automatically update Power BI reports. I struggled with the same issue as I can see several others have which is the system / client name. My test system is QU1 and Client is 003 hence enter QU1003 in cell 8 of the Excel. Many thanks for sharing your knowledge and can imagine many applications for this
Power Automate and Power BI is a good combination. I did not think about that!
THANK YOU VERY MACH FROM RUSSIA, MAN! I LOVE YOU! THE BEST GUIDE I'VE EVER SEEN! TOTALLY UNDERSTAND! THANK YOU!
It worked perfectly to us!!! You saved a lot of effort and time from my team by sharing your work and knowledge!! Thank you!!
Csongor, igen menő vagy, köszi szépen. Pár nappal ezelőtt kerestem rá guglin a SAP scriptingre és Te voltál az első találat. Videóidnak köszönhetően sikerült is saját scripteket készítenem, aminek nagyon örülök. Köszönöm, hogy megosztottad a tudásodat!
Orulok hogy segitett. Ez a slager temaja a csatornamnak, annak ellenere hogy ez csak 5-6 video.
That was extremely well done and easy to follow. THANK YOU TONS AND TONS.
I just executed my first script and have a list of new ones that I am going to start developing.
Hello.. Can u please tell me how to write that language format.. I want to make a script to run on SAP.. Pls ans me.. It would be appreciated
- 11:04 recording starting
- 12:43 Code Explanation
- 15:26 Explaining Excel
- 17:24 system variable in excel
- 19:31 Visual Basic code
Hi Csongor Varga, I just started exploring SAP Scrit and saw the Video, excellent explanation and learned lot, Thanks
You are welcome!
If you don't mind can I ask a question, for some changes we do in SAP there will be pop up window how do
I read it in macro and press enter only when there is window popped up.
+Satish Kumar I have covered this in another episode in my channel. Before the line for the pop-up window add "on error resume next" that will ignore any errors and continue the next line in the code.
Really helpful!!! you are one of the few youtoubers that actually tells you how to do it. Many many thanks!!!!
Thanks a lot mate!
Man this is so awesome! Thank you a lot!!!! My co-worker will love my future scripts =)))) There is so much bullshit on CZcams, but this content is so usefull! Thank you for sharing your efficient skills with us!
Thanks a lot! Happy scripting!
Can I automate SAP GUI without RZ11 authorization?
Thank you, i use win7 sap, but finally I was able to use with your example to capture the status bar
This is amazing!! You have saved me hours out of every week.
This is amazing content. Thank you for sharing this with everyone.
Still relevant! Thank you so much🙌
Hello Varga,
Thank you very much and it's the really very informative course.
it saved my day!
Nagyon hálás vagyok a videóért!
Sokat segített.
A very informative vlog. Will be very helpful for me to learn the basics. Thank you
Hi Varga, I used your code as reference to start setting up a fully automated regression test set for SAP HR, so thanks a lot!
I am glad to hear that. I started this whole journey for the very same reason (automate testing).
Hi Varga, I've just 1 question. I am able to log in in SAP using different users, though logging off is really difficult. Do you know the VBA code to log off from SAP?
The connection object (objConn) has a CloseConnection method. Try that. It also has a CloseSession method, but for that you need to provide the session id. So close connection could be easier if works. Sorry I don't have time to try them out myself.
@Csongor Varga how are you able to connect to SAP without loading the .dll's that are required for Excel to speak to SAP?
what happen if i keep SAPFEWSE.OCX file in D:\ folder,, is it mandatory to keep in c:\program files..........
BEST EXPLANATION EVER THANK YOU!!!!!!!!
Fantastic tutorial! Very helpful. Thank you very much!
Thank you for doing these videos. Speaking of one of your cons, I have noticed that if I minimize the SAP window while the script is running in a loop, it goes about twice as fast.
Good to know. I usually running modest scripts, so speed is not an issue for me. And I like to see it running.
Nézem a videot, hallgatom, mondom, de frankó az angolja, ahhoz képest, hogy külföldi, és KIDERÜL, HOGY MAGYAR :D:D
is there a way of running scripts local/client only without server option? Moving the menu's around like that shouldn't be Dependant on the server. This is what is freaking out the place i work for, they are worried at backend issues and wont enable the scripting. If i could show them that this is only local then they might enable it.
you are really awesome.explained every thing clearly.
Thank you so much for this thoroughly made video. Keep up the good work
Thanks man!
Thank you for sharing this. Great info!
Nice video series, thanks for sharing! ❤
You are welcome
Hi Csongor Varg, thank you so much for doing this..helped a lot!!!!
You are welcome
Thanjs you so much. Excelent explain and information
Thank you, made my script work in 1 hour. Super!
Excellent ! Thanks for sharing and explain each step of the process.
I am glad you find it useful.
Awesome Video. Thanks for sharing your knowlegde.
You are a star! its works like a winner :)
Great work and brilliantly explained each and every point. Plz also upload video regarding Miro Posting and F-04 posting with clearing through script, if possible.
Awesome! Thank you so much for this!
Good Work and Thanks for your help to understand the concept. . SAP MM Mock Interview videos can be accessed in below play list
@
Nice! It really fills a gap. / Igazi hiánypótló mű ez kérem!
Great explanation! thank you for this, it really helped me!
HI Csongor,
This has helped me a lot when updating Multiple PO Lines in ME22N.
I just have one question though.
When I first recorded it, it is working.
However after a few days, it is no longer working.
I have rerecord the steps again for it to work.
Not sure what the problem is.
Thanks. Well, I am not sure what the reason can be. You can always debug the code and run the scripting part step by step. That way you see which lines are executed and where the script stops. It is possible that there is a pop-up message which will block the script from running the next line. You can also comment out the "On Error Resume Next" line and your script will stop where the issue is. Warning messages, confirmation pop-up messages could be causing the script to fail in certain cases.
Best video. it is amazing, that you contain so many information about what is possible, like reading status bar, error handling. i am probably responsible for like 1000 views :D
Thanks a lot man!
how would you capture the error from the display at the bottom or if any windows appear at the front... I tried it but vbscript just loop over the error message
Thanks very much , very useful video ..
Thanks for sharing. Very good and informative.
Thanks. I appreciate your hard work. Good job.
Hello Verga great video. I am trying to automate VA02, these code works perfect for me but since it’s VA02, can you please help me with the code to find the first empty row in sap? I want to add more items on to the same order thanks hips
Thanks. You can just loop through the items and look for the first item where the product field is empty.
Hi, Csongor, Thanks for sharing the vb script. I would like to add some if else statement into the recorded script section. Do you have some examples how to do it?
Thank you very much for the tutorial.Can you give me the link for downloading sap GUI script API library link?
Very helpful!
33:40 you can copy them to word and replace them all
Thank you for this amazing video. It was fairly easy to set this up. Fantastic job.
Such a clear explanation. Can we run this without showing sap window update.?
No, gui scripting works like that. Unless you minimise the gui window so you don't see it.
Very helpful , keep doing Great work
Amazing script!
Thanks...you r awesome
This whole playlist is still applicable, and very useful! Thank you. Would you consider doing a video on the FM RSAU_READ_MASTER_DATA?
Thanks very much, I've created a macro and want to run it first in the test environment rather than the production environment but the script got stuck at the sap children 0 step in the beginning. It was running fine in the production environment though. I would appreciate if you could help please
The script takes the SID and client form a cell on the sheet. So you just need to change that to your test client... I am not sure why it is not working.
Hello Varga, great video! You have great skills in simple explanation of complex aspects. I am a SAP developer and I have two questions:
(1) Why did you not used the batch input technique of SAP for your own project? It's more integrated in SAP / ABAP and runs much faster than VBS scripting. Recording batch inputs with transaction SHDB is as easy as recording a GUI script?
(2) Is SAP GUI compatible with SAP S/4HANA? I don't think so.
Kind regards,
Thomas
To be honest, besides GUI scripting I only know LSMW. And it does struggle with some complicated GUI transactions with lot of tabs. This is why I started looking elsewhere. Maybe the batch input would be just as good. But I was knowledgeable in VB script and also in Excel macros so this seemed a perfect tool for me. And the fact that no transports are required for it.
(1) you are certainly right on that. Batches are faster. But GUI scripting is the best tool to create cross SAP-Excel App. For VBA users, its gold. They make useful apps for reporting and analytics faster than making a z-transaction.
(2) Yes, it still used in S/4HANA. There's no anouncement stating that SAP GUI will be definitively discarded.
Thank you for sharing with us :)
You are welcome!
Thank you, it's very helpful
Thank you very much for this video! It helps me so much on my automations for SAP
I have a code, which opens the SAP Logon and logs into my system using my username and password. The code works well, but only if sap is not open at all
Do you know how i could include a check whether sap is open already?
Logic should be, that if the SAP Logon is already open, the code should skip the part where it tries to open the SAP Logon.
And if there is an active session on my system(e.g. P1), it should skip the part logging into it.
But if there is an active session on another system(e.g. P2), it should still log into the system which i defined in the code (P1)
Im struggling with that
Maybe you know a way how to do it :)
Thank you in advance!
In my example you find and Attach_Session function which attaches to an open session. That returns false if it was unsuccessful. You can use that to try to attach to a session and if it is False, you can bring in the logon window.
Thank you so much! Very well explained. :)
May need your help here :)
I am working on a scenario where the logic needs to apply a Filter on a particular column in SAP and paste a value form Excel. Positive result is single entry only in SAP Screen.
In case row is found, script needs to click on update button and copy other details from Excel into SAP. (This works fine, Thanks to you! :) )
In case no results found after applying filter , it needs to start processing next record form excel. (not able to handle this one)
For your question the answer depends on how the transaction works. You can check the existence of a screen field to tell if it is on the screen or not. You can use the FindById method and if it returns an empty object (Nothing) it is not on the screen.
Brilliant sharing, it is very useful.😄
MERCI
and thank you very much
How do you use this with SAP BI ( online)? We have a broadcaster function on our company SAP. To extract data to be used in Excel, we use a hyperlink which takes us to a prompt window and from there we choose the month for which we want to extract data for and the query presents itself in table format online. Then we export it to excel and work with it in excel. My question is how to automate this? How to get multiple reports set on broadcaster with dynamic prompt? Is there a way?
fantastic job!
Thank you very much for the video... I am starting to work with SAP and this is a great help, I just can't get the error or the message that appears in the column "E" does anyone know how to get this message?
What error message you mean?
@@csongorvarga I mean the SAP status bar message, You explain it at Minute 18:30
@@MrPichi07 Well, I think you have to debug this. Maybe there is an error in the script and it does not get to the part to read the status bar message...
For me it's working just session in beginning is the each row of scripting.
Why I want to change as objsess
MERCI and thak you very much
hello its appreciate; you have extreme knowledge.
Very good my friend.
Really useful. Thank you
Thanks for video . I have a question about data extraction from SAP, for example, I have an excel file and I want to feed them from SAP as real-time or whenever I want due to this file feeds to other system Power BI or Other Reporting tools
what is the best solution for this case ? Could you please give me a recommendation ?
I am having difficulty with identifying the session to put in cell A8. I can't determine what it is and if you need access to SCC4 to determine, I don't have permission. I tried to identify by reading the SAP bottom right corner where I see system which reads "PR1 (1) 100" and client "100". When I put any guess in cell A8 it does bring up a dialog box "No active session" followed by "Not connected to client" followed by "Script complete". When I used 100 it error to "MsgBox "No active session to system " + W_System + " with transaction " + tcode + ", or scripting is not enabled.", vbCritical + vbOKOnly". HELP!
Yeah - I figured out where I was going wrong - code works great! Dipesh you rule!
@@rminjoe Hi Minjoe, I am getting the same error
How did you fix it. Pls tell me
thank you sir
Amazing, thank you.
i love you man! thank you for this. if you drop by cebu philippines. let me know. :D. i would like to invite you for a beer! i have been looking for this solution
Hi! Thank you a lot! I only have one question. I can run a vba code that runs different transactions in different SAP sessions? Thank you!
Yes, in my code I create a variable for a session and connect to a gui session based on the sid and client id. You can create another session variable and connect to another session in the same system or even different system. I have never done an example like that, but I see no reason why it would not work.
Very helpful
still trying to close applications and move to next when there are multi-pal blanks between orders
Hi can you please make a macro based on SAP GUI Scripting for internal order settlement through KO88. I have around 127 internal order error to be settled in one day
please help.
When I open up C:\Program Files(X86)\GUI, I only get the following two folders:
SAP Business One
SAP Business One DI API
no sign of ...SAP\frontend\sapgui . Using Agent Ransack, file name *GUI*, I only find \SAP Business One\GUI, and no files with the string GUI or gui in it.
Do I have the wrong version of the client?
It looks like you have Business One. To be honest, I don't know how that compares to the ERP SAP, but I think that does not use GUI. So this will not be any use for you.
Hi, at 20:13 you mention the selection SAP GUI Scripting API or the "sapfewse.ocx", what do I do if I don't have those options at all? You mentioned without this selection the scripting won't work.
Unfortunately I have no idea why that would be missing, that is part of my SAPGUI installation. Maybe you can try to re-install the SAPGUI, or upgrade it.
@@csongorvarga Hi, I followed the file path manually which was not available in tools of VBA, copied the path and then in VBA in the browser section past the file path, and then only did it become available for selection. Thank you so much.
Is it possible to schedule one on one sessions with you? I have very basic/starter knowledge and need some guidance on the SAP part of the scripting. I'm busy with a project to automate various manual steps of our operations.
@@alteavanloggerenberg2464 I am quite busy and it is hard to find time, but you can email me on csongor dot varga at gmail dot com. That would be easier.
Awesome!
very well explained
Hi i am finding your videos are extraordinary. And i want to create bom for multiple header material. I able to create scripting for single header material. Could you please guide if more than one bom to be created with a single script.
Good to hear, happy scripting :)
If you could give me a method to upload pdf in the document it would help me a lot
Thank you very much for the post. I tried to download the sample file so I can follow along, but came up short. Could you please download it the cloud again and share the link with me.
I have developed a similar code and was wondering how could I copy data from SAP to Excel. I tried "Objsheet" method but it doesn't seem to be working. Would you please explain how could this be accomplished in brief?
Awaiting your valuable feedback :)
Hi sir.. I'm trying to automate few check points in manual Purchase order creation apart from catalogue. My simple check point is to check vendor is XK03 with corporate group.
Please help me how can I run it macro..
Thank You Varga, this video helps a lot. I only have a problem, when i am executing the script the code is being executed to the first SAP session and if i have other tcode on running VBA throws error. can you highlight where the code might go wrong.
Yes, this is now I designed the code. The intention was that script connects to the session which runs the transaction in case you are logged into the same client in multiple sessions. Look for this in the code: "And W_Sess.Info.Transaction = tcode" and remove from the line.
+Csongor Varga Thank you for the reply. I have removed that line (tcode) from script. Is there a was if the first session is running a tcode, can the script open a new session and run VBA code?
Do not remove the entire line, just what I quoted. I have not tried running two scripts at the same time. You need to check that.
yes Varga, i dint remove the entire line. i removed only the one which you have quoted. by the way Thank you for your support . Appreciated.
Hi, great videos! really helpful. I have one report that i am extracting data from ....cs11 - BOM extract. But i need to get the Base qty from the BOM header. I cannot find how to reference the report header in the code...and the recording doe not pick it up. The field i need is "Base Qty (EA)". any help appreciated. thks.
I am running script for VT02N but its not updating the value.Script saying completed. Can you help
If the script has "On error resume next" comment it out and see what happens. Also run the code step by step and see what is going wrong.
Excellent video's. i have my script creating me a transport number. how can i get that number fed back to my spreadsheet so i can reuse it later?
If you get the transport number as part the message on the status bar, you can get it with ...FindById("wnd[0]/sbar").Text. Otherwise create a new recording in which you select field where the transport number is displayed. That will be part of the recording as something.Selected or similar. That tells you how to get that field and it probably has a Value or Text property which give you the actual value. For example in another video, I used the following line to get the order number from the status bar. I used the Mid function to slide the number out of the message text: Cells(5, 5).Value = Mid(objSess.FindById("wnd[0]/sbar").Text, 16, 10)
Hi Mr. Csongor, I encountered an issue when trying to save the Scripting.vba into the local file, which previously had no any issue, until these few days I encountered an popup warning message -- Frontend Server : -- this process cannot access the file because the folder is used by another process...' not sure if you know how can I get this resolve...I asked a colleague to try SAP scripting from their laptop by their user account, they don't have such issue, as I didn't have this issue before either...ThanksEric
Hi Csongor, I don´t know what is wrong, but I can´t connect to client and system ID correctly. After login to reevant SAP syste it shows: System: HP1 (1) and Client 088. What I need to do? Thank you
Could be a few reasons. On some of my scripts the SID and client is in the VB code. Sometimes it is on the Excel sheet. That needs to change to HP1088 in your case. And also your client must be enabled for script playback.