Reg: Save button in SAP application
When we trying script for SAVE button using DP it is not working ("General run Error" is displayed) script as follows,
SAPGuiSession("type:=GuiSession").SAPGuiWindow("ty pe:=GuiMainWindow").SAPGuiButton("guicomponenttype :=40","name:=btn").Click
When we trying script for SAVE button using Shared repository it is working script as follows,
SAPGuiSession("Session").SAPGuiWindow("Create Purchase Order").SAPGuiButton("Save (Ctrl+S)").Click
Please let us know solution for the above issues.
can you try the below once and let us know
SAPGuiSession("type:=GuiSession").SAPGuiWindow("ty pe:=GuiMainWindow").SAPGuiButton("guicomponenttype :=40","name:=btn\[11\]").Click
Thanks, The above code is working fine.
Could you please explain what is the purpose of using backslash(\) in the name property.
Let me try to explain.
I have not worked with QTP/WinRunner/SAP for many years but I think that the names of the buttons have the square brackets as part of the identifier.
In QTP/UFT, when dp is being used in a description...the description is always considered to allow for regular expressions. The brackets mean something in regular expression rules. I think that it means that a match occurs on any value inside of the brackets. So the btn is seen as btn1. There is no object that matches this.
The \ character means to treat the character on the right as a literal value and not to use it as a regular expression character. Then it sees the name as btn .
I hope I was of use here.