cancel
Showing results for 
Search instead for 
Did you mean: 

How can I execute 6 sessions in parallel?

Former Member
0 Kudos

Hi

I've been working on this for a couple of weeks. I've searched the internet (including scn.sap.com ), asked people and have come up empty.

this site/discussion area has been a great help, but I can't find a way to execute multiple sessions at once.

here's the scenario.

I have 6 custom reports that I run daily that take 30 minutes to run serially. If I run multiple sessions in parallel, It takes 5 to 10 minutes.

Using excel/VBA, I have  connected to SAP, started 6 sessions (session.createsession), each session navigates to its custom report screen, set variant and now want to run them at the same time/in parallel/asynchronous/concurrently...

I've tried "SendVKey 8" and .Press (execute button), but they execute one at a time instead of all at once.

Here's a test with 2 sessions. control isn't returned each step is complete.

With SAPConnObj

  .Children(0).FindById("wnd[0]").Restore  'make active

  .Children(0).FindById("wnd[0]").SendVKey 8

  '.Children(0).FindById("wnd[0]/tbar[1]/btn[8]").Press

  .Children(3).FindById("wnd[0]").Restore  'make active

  .Children(3).FindById("wnd[0]").SendVKey 8

  '.Children(3).FindById("wnd[0]/tbar[1]/btn[8]").Press

End With

I can't believe I'm the only one that wants to do this.

If I can't run them in parallel, can I run them in the background?

that may accomplish the same thing.

Any help/code would be appreciated.

Regards,

Steve

Accepted Solutions (0)

Answers (1)

Answers (1)

stefan_schnell
Active Contributor
0 Kudos

Hello Steve,

as far as I know is VBA single threaded and it is not possible to run multiple threads or processes.

I think one way is to code six different VBScript files with your code. Start each from Excel with the VBA command Shell, here an example:

Shell "wscript.exe MyScript1.vbs"

Shell "wscript.exe MyScript2.vbs"

etc. etc. etc.

Let us know if it works.

Cheers

Stefan

Former Member
0 Kudos

Hi Stefan,

Thanks for the reply. I asked Scriptman offline and he provided some code to get me started. i haven't had time to test it but plan to this week. I'll reply back with the results when I'm done. I hoped there would be an easier way, but the work around may work.

I also thought about using APIs to get around it but didn't see anything to get me started.

thanks again for the reply. This forum and its contributors are great resource.

Regards,

Steve

former_member622450
Discoverer
0 Kudos

Hi,

Can you guys check this page out? i am unable to understand the WSF tags

https://www.smartspate.com/how-you-can-automate-work-in-sap-with-vbscript/

0 Kudos

Hello Stefan,

Hope you're doing well. Can you please give a sample of this workaround using a shell code. Like executing 2 scripts at the same with two different sessions.

Thanks in advance