Skip to Content
0
Jul 28, 2023 at 09:07 PM

GUI Scripting ME22n Change Delivery Date in "Position"

196 Views Last edit Jul 28, 2023 at 09:10 PM 3 rev

Hi,

I have problems selecting the cell of the confirmed delivery date (in German "Lieferdatum") in ME22n via script. I recorded and tried my script in the Q-system (my company doesn't allow recordings in the P-System), and it works without any problem. In the P-System, an error pops up as soon as the script tries to select the cell (I highlighted the cell yellow).

image.png

Here is the relevant part of my code:

'open ME22n and the specific order
objSess.FindById("wnd[0]/tbar[0]/okcd").Text = "/NME22N"
objSess.FindById("wnd[0]").SendVKey 0
objSess.FindById("wnd[0]").SendVKey 17
' use the PO number from an excel file
objSess.FindById("wnd[1]/usr/subSUB0:SAPLMEGUI:0003/ctxtMEPO_SELECT-EBELN").Text = Worksheets("Script").Cells(currentline, 1).Value 
objSess.FindById("wnd[1]").SendVKey 0

'starting to loop through the rows
Dim i As Integer
i = 0
Do
        Dim Datum As Date
        Dim datum_alt As Date

' !! THE FOLLOWING LINE CAUSING AN ERROR !!
        Datum = objSess.FindById("wnd[0]/usr/subSUB0:SAPLMEGUI:0020/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT17/ssubTABSTRIPCONTROL1SUB:SAPLMEVIEWS:1101/subSUB2:SAPLMEGUI:1332/subSUB0:SAPLEINB:0300/tblSAPLEINBTC_0300/ctxtRM06E-EEIND[2," & Int(i) & "]").Text
        datum_alt = Worksheets("Script").Cells(currentline, 4).Text
        Dim menge As Integer
        Dim menge_alt As Integer
'!! SAME HERE !!
        menge = objSess.FindById("wnd[0]/usr/subSUB0:SAPLMEGUI:0020/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT17/ssubTABSTRIPCONTROL1SUB:SAPLMEVIEWS:1101/subSUB2:SAPLMEGUI:1332/subSUB0:SAPLEINB:0300/tblSAPLEINBTC_0300/txtEKES-MENGE[4," & Int(i) & "]").Text
        menge_alt = Worksheets("Script").Cells(currentline, 5).Text

        If datum_alt = Datum Then
                Worksheets("Script").Cells(currentline, 6).Value = "JA"
                Else: Worksheets("Script").Cells(currentline, 6).Value = Datum
        End If
        If menge = menge_alt Then
            Worksheets("Script").Cells(currentline, 7).Value = "JA"
            Else: Worksheets("Script").Cells(currentline, 7).Value = menge
        End If
i = i + 1
Loop Until Worksheets("Script").Cells(currentline, 6).Value = "JA" And Worksheets("Script").Cells(currentline, 7).Value = "JA" Or objSess.FindById("wnd[0]/usr/subSUB0:SAPLMEGUI:0020/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT17/ssubTABSTRIPCONTROL1SUB:SAPLMEVIEWS:1101/subSUB2:SAPLMEGUI:1332/subSUB0:SAPLEINB:0300/tblSAPLEINBTC_0300/ctxtRM06E-EEIND[2," & Int(i) & "]").Text = ""

In general, the following code does not work:

objSess.FindById("wnd[0]/usr/subSUB0:SAPLMEGUI:0020/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT17/ssubTABSTRIPCONTROL1SUB:SAPLMEVIEWS:1101/subSUB2:SAPLMEGUI:1332/subSUB0:SAPLEINB:0300/tblSAPLEINBTC_0300/ctxtRM06E-EEIND[2,0]").SetFocus

Does anybody have any idea what could be wrong? How could the code work in the Q system but not in the P system?

Thank you very much! With best regards, Simon

Attachments

image.png (40.7 kB)