Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HELP]Button no longer works in the transaction ME21N(SAP/QTP)
#1
Solved: 11 Years, 4 Months, 3 Weeks ago Question 
Hi,

I am automating a process of SAP, transaction ME21N in HP QTP.

This generates the Purchase Order for this transaction will be in a copy of Purchase Requisition.

The option to perform the copy, is to click in a Variant Selection button, Purchase Requisition option.

Button image:    

I am using the following command to open the function. It was working, but it is not working now.

.
Code:
SAPGuiWindow ("Create request"). SAPGuiToolbar ("ToolBarControl"). PressContextButton "SELECT"
. SAPGuiWindow ("Create request"). SAPGuiToolbar ("ToolBarControl"). SelectMenuItem "Purchase Requisition"


Can anyone help with this case?
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Hey do you need to select a variant and then just execute the transaction?

Please elaborate your requirement.

I have also worked on ME21N --To create purchase order. What i do is enter the Org datas and Material and just hit save. It works fine.

Regards,
Ankesh
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
I need to create a Purchase Order based on a Purchase Requisition.
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
As per your post you are not able to click on a button.

The code which u have posted shows that you are selecting some menu items. It would be better for me to help if you could post you code, requirement and screenshot of the page. Can you post the object spy for that object too?

Regards,
Ankesh
Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
   

I need select the menu item marked in red.
When I select this item, it displays a screen where I fill the purchase requisition number and click on the Execute button.

So, I create a purchase order based on the purchase requisition.

object is marked in blue:

Code:
"Class Name: = SAPGuiToolbar"
"abs_x: = 17"
"abs_y: = 236"
"enabled: = True"
"guicomponenttype: = 202"
"height: = 24"
"id = / app / con \ [0 \] / ses \ [0 \] / wnd \ [0 \] / shellcont / shell / shellcont \ [1 \] / shell \ [0 \]"
"name: = shell \ [0 \]"
"type: = GuiShell"
"width: = 367"
"x: = 0"
"y: = 0"


"Class Name: = SAPGuiToolbar"
"abs_x: = 17"
"abs_y: = 236"
"enabled: = True"
"guicomponenttype: = 202"
"height: = 24"
"id = / app / con \ [0 \] / ses \ [0 \] / wnd \ [0 \] / shellcont / shell / shellcont \ [1 \] / shell \ [0 \]"
"name: = shell \ [0 \]"
"type: = GuiShell"
"width: = 367"
"x: = 0"
"y: = 0"


Code:
Code:
If SAPGuiSession("Session").Exist(2) Then
Reporter.ReportEvent micPass, "Session", "Tela Session exibe com Sucesso"
With SAPGuiSession("Session")
.Reset "ME21N"
If  .SAPGuiWindow("Criar pedido").Exist(2) Then
Reporter.ReportEvent micPass, "Criar pedido", "Tela Criar pedido exibe com Sucesso"
If .SAPGuiWindow("Criar pedido").SAPGuiButton("Ativar síntese de documentos").Exist(2) Then
.SAPGuiWindow("Criar pedido").SAPGuiButton("Ativar síntese de documentos").Click
End If
Expandir
.SAPGuiWindow("Criar pedido").SAPGuiToolbar("ToolBarControl").PressContextButton "SELECT"
.SAPGuiWindow("Criar pedido").SAPGuiToolbar("ToolBarControl").SelectMenuItem "Requisições de compra"
.SAPGuiWindow("Requisições de compra").SAPGuiEdit("Nº requisição de compra").Set reqCompra
.SAPGuiWindow("Requisições de compra").SAPGuiEdit("Nº requisição de compra").SetFocus
.SAPGuiWindow("Requisições de compra").SendKey ENTER
.SAPGuiWindow("Requisições de compra").SAPGuiButton("Executar  (F8)").Click
.
.
.
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
Hey code is fine. It is working fine for me. What error are you facing?
Reply
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
This is the error:
   

The code worked normally until a few days ago.
I could not understand why it does not.

Before I forget, thank you for your attention and help.
Reply
#8
Solved: 11 Years, 4 Months, 3 Weeks ago
This error usually happens when the item you are trying to select is not available in the list.

Make sure the item you are trying to select is listed under the menu.

Can you try this alternate code.

Code:
SAPGuiSession("Session").SAPGuiWindow("Create Purchase Order").SAPGuiToolbar("ToolBarControl").PressContextButton "SELECT"
SAPGuiSession("Session").SAPGuiWindow("Create Purchase Order").SAPGuiToolbar("ToolBarControl").Object.SelectContextMenuItemByText("Purchase Requisitions")

Let me know the output.

Regards,
Ankesh
Reply
#9
Solved: 11 Years, 4 Months, 3 Weeks ago
Now it worked! Big Grin

You saved my life ! LoL
Thank you for help!
Reply
#10
Solved: 11 Years, 4 Months, 3 Weeks ago
Glad that it worked for you Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Not able to click the save button in Save As window while downloading from SAP kathirvelnagaraj 0 2,480 08-25-2015, 07:37 PM
Last Post: kathirvelnagaraj
  QTP not clicking on the flex button sudheerch 2 3,673 12-03-2013, 12:56 PM
Last Post: sudheerch
  Same code on running with UFT11.5 gets slow and browser hangs but works fine inQTP11 Rashi 1 2,579 03-02-2013, 04:12 PM
Last Post: vinod123
  Function written in Func library is not returning values but works in same script Shwethareddy 5 4,746 02-25-2013, 10:55 AM
Last Post: vinod123
Question <Interesting> Is it possible to execute SAP GUI application without QTP Jyobtech 3 3,695 09-07-2012, 12:26 PM
Last Post: SIBICA

Forum Jump:


Users browsing this thread: 1 Guest(s)