cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization issue with SAP session1 and session2 using QTP/UFT automation

Former Member
0 Kudos

Hi Guys,

I am using UFT to automate SAP application. My scenario is to automate the SAP Mail creation using the SWBP transaction. During the execution of the script while clicking the New Message button then new SAP session should open and need to compose the mail. But, got the error New Message button during the execution. Below is my script


'Creating a description object for SAP session

  Set sSAPSession = Description.Create()

  'Add descriptions and properties for SAP session

  sSAPSession("guicomponenttype").value = "12"

  sSAPSession("name").value = "ses\[0\]"

SAPGuiSession(sSAPSession).SAPGuiWindow("name:=wnd[0\]","type:=GuiMainWindow").SAPGuiOKCode("name:=okcd","type:=GuiOkCodeField").Set "SBWP"

  SAPGuiSession(sSAPSession).SAPGuiWindow("name:=wnd\[0\]","type:=GuiMainWindow").SAPGuiButton("name:=btn\[0\]","type:=GuiButton").Click

  SAPGuiSession(sSAPSession).SAPGuiWindow("guicomponenttype:=21","transaction:=SBWP").SAPGuiButton("name:=btn\[16\]","text:=New message").Click

  SAPGuiSession("guicomponenttype:=12","name:=ses\[1\]").SAPGuiWindow("guicomponenttype:=21","text:=Create Document and Send").Activate

=========Error during the runtime =======

Cannot find the "[ SAPGuiWindow ]" object's parent "[ SAPGuiSession ]" (class SAPGuiSession). Verify that parent properties match an object currently displayed in your application.

Line (20): "SAPGuiSession("guicomponenttype:=12","name:=ses\[1\]").SAPGuiWindow("guicomponenttype:=21","text:=Create Document and Send").Activate".

=====================================

Please give u r suggestions to resolve the issue ..

Thanks

kathirvel Nagaraj

Accepted Solutions (0)

Answers (1)

Answers (1)

stefan_schnell
Active Contributor
0 Kudos

Hello Kathirvel,

you open with

session.findById("wnd[0]/tbar[1]/btn[16]").press

in your case

SAPGuiButton("name:=btn\[16\]","text:=New message").Click

a complete new session.

In this case it is necessary to set a new session

Set session1 = connection.Children(1)

in UFT maybe like:

...

sSAPSession1("name").value = "ses\[1\]"


I am no UFT (Unified Functional Testing) expert, but this is the way in VBS.


Let us know your result.


Cheers

Stefan

Former Member
0 Kudos

Hi Stefan Schnell,

Thanks for your response.

When i add Wait then  my script executed without any error.But while running this cases with other cases continuously  then got the error intermittently..

So i need solution run the script without any error.

Set sSAPSession = Description.Create()

     'Add descriptions and properties for SAP session

     sSAPSession("guicomponenttype").value = "12"

     sSAPSession("name").value = "ses\[0\]"

SAPGuiSession(sSAPSession).SAPGuiWindow("guicomponenttype:=21","transaction:=SBWP").SAPGuiButton("name:=btn\[16\]","text:=New message").Click

wait 10


     Set sSAPSession1 = Description.Create()

     'Add descriptions and properties for SAP session

     sSAPSession1("guicomponenttype").value = "12"

     sSAPSession1("name").value = "ses\[1\]"

     SAPGuiSession(sSAPSession1).SAPGuiWindow("guicomponenttype:=21","text:=Create Document and Send").Activate

Thanks

kathirvel Nagaraj

stefan_schnell
Active Contributor
0 Kudos

Hello Kathirvel,

good to hear that your synchronization problem from your first post is solved.

It is necessary to wait until the new session is open, because the SAP GUI Scripting needs the open session to communicate with it.

Can you please specify by an example what you exactly mean with "But while running this cases with other cases continuously  then got the error intermittently." Do you use another transaction code? Or do you send different e-mails from the Business Workplace?

Cheers

Stefan

Former Member
0 Kudos

Hi Stefan Schnell,

Error occur while sending the different e-mails from the Business Workplace continuously.


Also, i Have set the "Wait 10" as static .


I there any possibility to  get the exact wait time required for the different e-mails creation from the Business Workplace .



Regards,

kathirvel Nagaraj