Bonjour à tous,
Avant tout je ne sais pas si mon post est au bon endroit !!
Je souhaite derrière un évennement "AfterUpdate" ouvrir une session SAP et recupérer (copier) une info d'un champ SAP et le coller dans un champ access.
j'ai ce code mais j'ai un pop up sur la ligne 2 Set Proc
message: "Compile error: Assignment to constant not permitted"
Je ne suis pas DU TOUT de connaissance !!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 Private Sub OTBareCodeSelection_AfterUpdate() 'The below section will create an SAP session. Set WshShell = CreateObject("WScript.Shell") Set Proc = WshShell.Exec("C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe") Do While Proc.Status = 0 WScript.Sleep 100 Loop Set SapGuiAuto = GetObject("SAPGUI") Set SapGuiApp = SapGuiAuto.GetScriptingEngine Set oConnection = SapGuiApp.OpenConnection("..SAP2000 Production PGI", True) Set session = oConnection.Children(0) session.findById("wnd[0]").resizeWorkingPane 107, 26, False session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "USERXXXXX" session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "MDPXXXXXXX" session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "fr" session.findById("wnd[0]/usr/txtRSYST-LANGU").SetFocus session.findById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2 session.findById("wnd[0]").sendVKey 0 session.findById("wnd[0]/tbar[0]/okcd").Text = "/nlt21" session.findById("wnd[0]").sendVKey 0 session.findById("wnd[0]/usr/txtLTAK-TANUM").Text = "OT_NUMBER_XXXXX" session.findById("wnd[0]/usr/txtRL03T-TAPOS").Text = "POSTE_OT_NUMBER_XXXXX" session.findById("wnd[0]/usr/ctxtLTAK-LGNUM").Text = "MAGASIN_XXXXX" session.findById("wnd[0]/usr/ctxtLTAK-LGNUM").SetFocus session.findById("wnd[0]/usr/ctxtLTAK-LGNUM").caretPosition = 3 session.findById("wnd[0]").sendVKey 0 session.findById("wnd[0]/usr/ctxtLTAP-MATNR").SetFocus session.findById("wnd[0]/usr/ctxtLTAP-MATNR").caretPosition = 0 End Sub
Merci
Totor
Partager