SAP VB Scripting and GuiXT Blog
Using VB Scripting at work in SAP Accounts Receivable, with each script, I find new challenges and code that needs to be implemented to meet end user needs such as adding a button to execute a script: https://scn.sap.com/thread/1526174 , runnning a script in a child session: http://scn.sap.com/thread/2035084 and use of SAP GuiXT to change the appearance of a screen without compromising the database: http://scn.sap.com/docs/DOC-48796. The resources available in SCN to meet these challenges are terrific. Marrying up SAP with a computer programming language that has been in use for a number of years (VB) today still can save significant processing time for end users. In the case of GuiXT, make use of SAP screens so much easier for new and even experienced users. I wanted to create this blog to collate this great information and contribute to the extensive knowledge sharing on SCN.
Some rules (work in progress) creating scripts and then adding a guixt button to execute the script
1. Obtain end user requirements
2. Record the and test the script (SAP Test, a great way to go)
3. Debug the script by own knowledge, VB debugging (Excel is a useful tool to
copy/paste VB Code to check for errors)
4. If code error from SAP code generated, check information online (eg.SCN)
and from previous scripts as you build up a library of scripts and knowledge
5. Test the debugged script
6. Attach image/button to the script in GuiXT
7. Review and improve script once in production through end user feedback
Great day, getting my project script out to create customer account in SAP FI. Learned so much through the creation of the script.Today in particular, running the session in a child session. Content at scn link: http://scn.sap.com/thread/2035084 found very useful, adding to this:
msgbox "Please select a session within the next 3 seconds after clicking ok"
set session = application.ActiveSession
I extended the sleep time to 4000 (4 sec) and the script seemed to respond better (in finding the current session). Thanks again james maccalous.
At this stage, the other big learning I'm finding is that with each test data run through, more often than not, a bug is found, so more research is required to improve and evolve the code. Thanks also to Script Man for your input in scn, has been very helpful.
More work today on SAP Scripting project - automate create customer account. At the point where at the customer address screen in v-09, user cannot go goto next VBSCript InputBox until a correct entry has been entered and committed to the field in SAP. 2 error checking methods used so far:
1. nested if(value <> "text value" and next value <> "text value"....)
2. opening a text file of acceptable values and comparing this to the user input
both methods employing 'Loop Until (value=userInput)'
The estimated time savings once the script is completed compared to normal input time (even with hold screen option available) should be significant as the script automates the mouse clicks through field and screens.
Have now been able to read user input from console, then open a text file to compare user input for true values from the text file. Can do this multiple times (open/close file as many times as required) to avoid nested if statements. Interesting to see how SAP and Visual Basic marry to each other. Whilst the code is dependant on each other to successfully run the script, there is a degree of independance within each construct (VB and SAP screen input) where a certain flexibity exists. Has been a real steep learning curve having used SAP for so long at work and having studied programming previously and now ERP systems. We're now in the cloud era, no doubt there, but the use of pre-existing technology will save massive time and cost for businesses. Will write more until project completed, essentially summate in the form of topics around "Building blocks for a SAP VBScript Project" leaning towards "Use of pre-existing technologies to streamline business processes"