cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Scripting in Code Stage

Daniel_JebarajJ
Level 3
Hi All, I know the SAP GUI scripting works well with Microsoft Excel. Is there a way to execute SAP scripts in code stage in Blue Prism? If Yes, What needs to be done in this case?   Regards, Daniel
6 REPLIES 6

Davidde_Miguel
Level 2
I want to Know the same.   Please could somebody helps us?

RomanChrast
Level 2
Hi, it is possible either by spying exact way as you would start SAP script manually.. OR faster way is to start SAP script via Utility - Environment --> ""Start process"" where you insert script path.    

Davidde_Miguel
Level 2
I know it, but i don´t want to put code in files to execute it, i want to develop the code in Blueprism

This can be achieved using Code Stage.

Step 1:  Have your script ready. In my case , I use the SAP recording feature (Customize Layout - > Script Recording and Play Back) to generate               script.
             From the generated script Recording take code starting from "session.findById("wnd[0]").maximize ......"

Step 2: Go to Initialize action in BO- under code options add the below name space
             "Microsoft.VisualBasic.Interaction"

Step 3: Open your code stage in any action and add these lines in it :
            
             Dim SapGuiAuto As Object
             Dim session As Object
             Dim Application As Object
             Dim Connection As Object

             SapGuiAuto  = GetObject("SAPGUI")
             Application = SapGuiAuto.GetScriptingEngine
             Connection = Application.Children(0)
             session    = Connection.Children(0)

Step 4: Now add your code from Step 1 in the after above line in code stage.

It will work fine.

------------------------------
Sharath Kumar Pennada
Consultant
Deloitte Consulting India Private Limited
Asia/Kolkata
------------------------------

Hi Sharath Kumar Pennada,

When I use 
If Not IsObject(session) Then
   session    = Connection.Children(0)
End If

then Blue Prism complained that IsObject is not declared. Do you know which namespace I have to import for that to work?

Thank you and best regards



------------------------------
Hoài Anh Ngô Vi
Technical Consultant
NTT DATA
Europe/Berlin
------------------------------

Hi Hoài Anh Ngô Vi ,

Please follow the steps mentioned above.
Step 2: have the namespace.
Step 3: You have to use entire code mentioned there.

Thanks,
Sharath

------------------------------
Sharath Kumar Pennada
Consultant
Deloitte Consulting India Private Limited
Asia/Kolkata
------------------------------