SAP has several connectors to automate all its transactions.
http://service.sap.com/connectors
One of the most interest things, is its capability to record all what you do with SAP and to save it in a script. You can then use it to automate all your tasks and embedded it in a Browser or for instance in a Web Based Software like Oracle OBIEE.
The following chapter come from [[https://www.sdn.sap.com/irj/sdn/sap-gui?rid=/webcont|SAP SDN]] where you can find all the useful informations that you require.
===== SAP GUI Scripting =====
==== Automate User Interaction with SAP GUI – and more ====
SAP GUI Scripting is an automation interface that enhances the capabilities of SAP GUI for Windows and Java. Using this interface, end users may automate repetitive tasks by recording and running macro-like scripts. Administrators and developers on the other hand may build tools for server-side application testing or client-side application integration.
* [[https://www.sdn.sap.com/irj/sdn/sap-gui?rid=/webcontent/uuid/007084d7-41f4-2a10-9695-d6bce1673c2f|Literature]]
* [[https://www.sdn.sap.com/irj/sdn/sap-gui?rid=/webcontent/uuid/007084d7-41f4-2a10-9695-d6bce1673c2f|Presentation and Exercises]]
* [[https://www.sdn.sap.com/irj/sdn/sap-gui?rid=/webcontent/uuid/007084d7-41f4-2a10-9695-d6bce1673c2f|Availability]]
==== Literature ====
[[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a064aed6-ecf4-2a10-6f9a-f9c966255019|Overview]] (PDF 18 KB)
This whitepaper offers an overview of SAP GUI Scripting. A user can utilize SAP GUI Scripting to automate SAP GUI by executing scripts that emulate user interaction. These scripts can be created manually from scratch or by recording user interaction.
[[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs|SAP GUI Scripting API]] (Zip archive 2,3 MB)
SAP GUI Scripting provides a set of scriptable objects wrapping SAP GUI. The document describes the interface that was designed to resemble user interaction, which can then be emulated using a script.
[[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3099a575-9cf4-2a10-9492-9838706b9262|Security Considerations]] (PDF 185 KB)
This guide deals with security aspects when using the SAP GUI Scripting API.
==== Presentation and Exercises ====
[[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/80aaac18-2dfe-2a10-bbb1-ec9b3760ea4c|SAP GUI Scripting API Presentation]] (PDF 1,3 MB)
This presentation explains the benefits you have when using scripts in your daily work. Also, it describes the security settings and recommendations for SAP GUI Scripting. In addition, you will learn to access the Scripting Object Model to collect and modify data in SAP GUI and how to use the SAP sample applications that help you to get started with your own development. Also, you will get to know some prominent appplications built using the SAP GUI Scripting API.
[[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e00d6fd4-eaf4-2a10-90a5-db931026edc8|SAP GUI Scripting API TechEd Workshop Exercise]] (PDF 278 KB)
In this exercise, you learn how to record and play back scripts using SAP GUI for Windows and SAP GUI for Java.
Availability
SAP GUI Scripting is available as of SAP GUI 6.20 for Windows and SAP GUI 6.20 for Java Revision 6. You find download information on the [[https://www.sdn.sap.com/irj/sdn/sap-gui|SAP GUI Family page]]. SAP System versions beginning with 3.1I are supported. A complete list of all requirements is available in the security documentation above.
===== How to record a script? =====
To record a script you can use the recorder embedded in SAP GUI (Alt + F12 to open the menu) or download the [[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_fes/%7Eform/handler%7B5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d353932363835%7D|recorder]] from SAP SDN. The recorder produce VBScript or JScript.
{{http://lh6.ggpht.com/_w1w-VtUdVxY/SRrRyLvXgbI/AAAAAAAAAfo/iPpO2mjin5w/s800/sap_gui_scripting_record_and_play_back.jpg}}
===== Script =====
Here below is a script to launch the material transaction (mm02) for a special material code.
I changed it a little bit :
* I added a parameter Vs_MaterialCode. In this way, we can launch the material transaction according to the material code.
* I formatted it with the tag to be able to use it in the Internet Explorer Browser.
* I added this instruction
Set Wrp = CreateObject ("SapROTWr.SapROTWrapper")
Set SapGui = Wrp.GetROTEntry ("SAPGUI")
because unfortunately GetObject will not access the Running Object Table when you call it from inside IE. This only works in the Windows Script Host.
ROT is the Running Object Table where active COM objects are registered.
===== How to integrate the SAP script in OBIEE Dashboard =====
If you want to be able to integrate this script in Oracle OBIEE, you must use the narrative view and :
* add in the narrative part the call of the vbsscript :
@1 - @2
* add in the prefix form the above script. In a other way, you can embedded in the OBIEE skin all your vbs library.
{{http://lh4.ggpht.com/_w1w-VtUdVxY/SRrRyCIJHXI/AAAAAAAAAfw/NoNYRLA65WE/obiee_narrative_sapscript.jpg}}
===== Security =====
==== Internet Explorer (Client) ====
The script launch an active X. Thus, if you want to be able to run the above script. You must enable the use of Active X.
To enable the ActiveX .. use the below procedure:
* Go to Tools -> Internet Options -> Security -> Custom Level
* Select Prompt in Download and others questions concerned the signed ActiveX controls.
* When prompted select Yes and you will be able to create the ActiveX object.
==== SAP Server ====
You have more information in the Security Considerations guide but to allow the scripting.
Use the transaction RZ11 to set the parameter sapgui/user_scripting to true to enable scripting at the server.
{{http://lh3.ggpht.com/_w1w-VtUdVxY/SRrTP5nZdPI/AAAAAAAAAf4/gW1Dc-KoSlE/s800/sap_rz11.jpg}}
===== Micrsoft Script Windows Debugging =====
To be able to debug a Windows script, you must install the [[http://www.microsoft.com/downloads/details.aspx?familyid=2F465BE0-94FD-4569-B3C4-DFFDF19CCD99&displaylang=en|Script Debugger for Windows NT 4.0]] and Later and turn on the debugging in IE
Go to tools->internet options->advanced. Make sure that “Disable Script Debugging (other)” and “Disable Script Debugging (Internet Explorer) are NOT checked.
You can find more information about debugging in this good article [[http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html|HOW-TO: Debug JavaScript in Internet Explorer]]
===== Script Editor =====
* [[http://astase.com/produits/vbsfactory/|VbsFactory]] a french but good and free editor
* [[http://www.bychoice.com/microsoft_script_editor.htm|Microsoft Editor]] Deliver with Miscrosoft Office MSE or MSE7.exe.
===== Other Interesting Links =====
* [[http://www.faqts.com/knowledge_base/view.phtml/aid|JavaScript: File: Executable: How to run executable file in JavaScript?]]
* [[https://www.sdn.sap.com/irj/sdn/thread?threadID=2477|Good thread in the SAP forum]]
===== Support =====
**ActiveX Can’t Create Object on Internet Explorer**
Verify that you have this instruction and not the orginal instruction from the recorder.
Set Wrp = CreateObject ("SapROTWr.SapROTWrapper")
Set SapGui = Wrp.GetROTEntry ("SAPGUI")

[...] liens intéressant sur le sujet Category: Python You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. Leave a Reply [...]
Text with Sap gui scripting for Python using Win32com
http://www.samuelbriere.com/?p=127