cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP GUI SCRIPTING: Material proposition window tooltip do not open with script running

bart_at_cwa
Newcomer
1,272

Hello gentlemen,

Do you know if material proposition window (tooltip table with material description window on screenshoot) can be opened with script running?

In my case: operator enters legacy code 50907 in Material, but this code is in Material_description, he confirms it by click and then registers quantity of FG to warehouse in MFP1. I have a script that takes confirmed material number, goes to folder finds .jpg project and opens picture on second monitor to compare drawing project with physical product if it is the same and operator doesnt register something else. My problem is that with script running this window proposition do not open. When there is no legacy code, meaning input from keyboard = material code in SAP - then all is good and there is no problem.

Do you know if I can have this proposition window working in SAP with script running and how to get this? Thank you

bart_at_cwa_0-1758728039581.png

script:

Dim SapGuiAuto, SAPApp, SAPCon, session
Dim shell, fso, drawingFolder, materialValue, drawingPath
Dim lastMaterial

Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

drawingFolder = "M:\Prod\photos\" 
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApp = SapGuiAuto.GetScriptingEngine
Set SAPCon = SAPApp.Children(0)
Set session = SAPCon.Children(0)

lastMaterial = ""

Do
WScript.Sleep 50000

If session.Info.Transaction = "MFP1" Then 

On Error Resume Next
materialValue = session.findById("wnd[0]/usr/subSPLITTED_SCREEN:SAPLVHUDIAL2:0053/subAREA1:SAPLVHUDIAL2:0110/tabsTABSTRIP1/tabpTAB1/ssubSUB1:SAPLVHUDIAL2:0200/ctxtPLAPPLDATA-MATNR").Text

On Error GoTo 0

If materialValue <> "" And materialValue <> lastMaterial Then
drawingPathPng = drawingFolder & materialValue & ".png"
drawingPathJpg = drawingFolder & materialValue & ".jpg"

shell.Run "taskkill /IM Photos.exe /F", 0, True

If fso.FileExists(drawingPathPng) Then
shell.Run """" & drawingPathPng & """"
ElseIf fso.FileExists(drawingPathJpg) Then
shell.Run """" & drawingPathJpg & """"
End If

lastMaterial = materialValue

WScript.Sleep 50000
End If
End If
Loop

 

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

FrankKrauseGUI
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello,
the enhanced search is not supported when using SAP GUI Scripting.
See also SAP Note 587202 - "Restrictions when using SAP GUI Scripting".
You can take over values for input fields from the modal (list based) searchhelp.
Best regards,
Frank