Micro Focus QTP (UFT) Forums

Full Version: [HELP]Button no longer works in the transaction ME21N(SAP/QTP)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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: [attachment=1032]

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?
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
I need to create a Purchase Order based on a Purchase Requisition.
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
[attachment=1034]

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
.
.
.
Hey code is fine. It is working fine for me. What error are you facing?
This is the error:
[attachment=1041]

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.
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
Now it worked! Big Grin

You saved my life ! LoL
Thank you for help!
Glad that it worked for you Smile
Pages: 1 2