cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Scripting in Blueprism

NidhiMehata
Level 3
Basic code for sap scripting in blueprism:
Dim session As Object
Dim Application As Object
Dim Connection As Object
Dim SapGuiAuto As Object

Application = CreateObject( "Sapgui.ScriptingCtrl.1")

Connection = Application.Children(0)
session = Connection.Children(0)

session.findById("wnd[0]/tbar[0]/okcd").text = "UPS"
session.findById("wnd[0]").sendVKey(0)


Let say we want to divide the actions into different code stages, how can we reuse the same session variable?
Can the session variable be stored in a local variable in blueprism? if so, what is the datatype to be given in local variable.

Or is it not possible to have multiple code stages.

Could you attach a sample release file for blueprism with sap scripting used.
2 REPLIES 2

Hey,

You can use the same in Global code stage which is present in init page of each object. Then you can create as many as actions and  you don't have to call this again and again
Dim session As Object
Dim Application As Object
Dim Connection As Object
Dim SapGuiAuto As Object

Application = CreateObject( "Sapgui.ScriptingCtrl.1")

Connection = Application.Children(0)
session = Connection.Children(0)

Above code you can put in Global Code stage.
Regards,
Amlan Sahoo

EVIPUTI
MVP
The same which i have posted for the last thread should help !

For SAP automation we need to do some pre config with SAP

Just create new SAP Object in blue prism
and start spying element using SAP Mode .
SAP Config Guide is available on internet easy. just refer the enable client side scripting section from it

Enabling SAP Spy Mode
To enable SAP spy mode, Blue Prism requires that both client- and server-side scripting are properly enabled.
i. Enabling Client-Side Scripting
• Start the SAP Logon and log in to the SAP server.
• Click the 'Customize Local Layout' toolbar button (ALT+F12).
• Click Options and in the GUI Options screen select the 'Accessibility and Scripting' node
• In the ‘Accessibility’ node ensure that the ‘Use Accessibility mode’ option is enabled.
• In the 'Scripting' node ensure that the ‘Enable scripting’ option is the only option set. Notifications must be switched off to prevent popups from blocking the spy mode.
o NOTE: If the options 'Notify when a script attaches to SAP GUI' check box and the 'Notify when a script opens a connection' are left checked then when you spy an element in the SAP interface you will see the message “A script is trying to attach to the GUI” every time you attempt to click on it. If you see the message “Scripting support is disabled by the user” then the ‘Enable scripting’ option has not been checked.
• Save the settings and restart the SAP GUI. The client-side settings have now been set.

Enabling Server-Side Scripting
• Start the SAP Logon and log in to the SAP server.
• Run the ‘RZ11’ transaction (type ‘RZ11 ‘and click the green tick button)
• Type ‘sapgui/user_scripting’ in the Maintain Profile Parameters window.
• Click the ‘Display’ button
• Click ‘Change Value’ in the Display Profile Parameter Attributes window.
• Type ‘TRUE’ in the ‘New value’ field.
• Save the settings and log out from SAP Logon.
• Exit from the SAP Logon program (click the red cross button in the toolbar, or click the ‘X’ window button to close the window and the application). You may be prompted to save any unsaved changes, if you haven’t done so already.

Just Configure sap and Blue prism as above instruction and start working.
------------------------------ Vipul Tiwari Senior Process Simplification Developer Amazon ------------------------------