How to Select Items on Tcode ME52N with VBA Script

3 months ago 22

Hi Dears,

kindly help I privation to prime an point connected T-Code ME52N with notation to the scope C5 but erstwhile successful macro it doesn't work. Thank you successful advance.

here is the macro:

Private Sub ME52N_Click()

Dim ComboBoxValue As String

ComboBoxValue = ThisWorkbook.Sheets("PROFILE INDICATOR").Range("C5").Value

Session.FindById("wnd[0]").maximize

Session.FindById("wnd[0]/tbar[0]/okcd").Text = "/NME53N"
Session.FindById("wnd[0]").sendVKey 0
Session.FindById("wnd[0]").sendVKey 17
Session.FindById("wnd[1]/usr/subSUB0:SAPLMEGUI:0003/ctxtMEPO_SELECT-BANFN").Text = Range("C4").Value
Session.FindById("wnd[1]/usr/subSUB0:SAPLMEGUI:0003/ctxtMEPO_SELECT-BANFN").caretPosition = 8
Session.FindById("wnd[1]").sendVKey 0
Session.FindById("wnd[0]").sendVKey 7

Session.FindById("wnd[0]/usr/subSUB0:SAPLMEGUI:0010/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").SetFocus

'the occupation is here:

Session.FindById("wnd[0]/usr/subSUB0:SAPLMEGUI:0010/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB1:SAPLMEGUI:6000/cmbDYN_6000-LIST").Key = ComboBoxValue

End Sub

Read Entire Article