Bonjour,
J'essaye via une macro-script de :
- Rechercher un numéro de document via la transaction FB03
- Créer un rattachement sur cette pièce en allant le chercher dans un répertoire commun
Ci-desous les lignes de code :
Sub RAJOUT_PIECE()
'
' RAJOUT_PIECE Macro
'
If Not IsObject(anApplication) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set anApplication = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = anApplication.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject anApplication, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "fb03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtRF05L-BELNR").Text = "3000215305"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/titl/shellcont/shell").pressButton "%GOS_TOOLBOX"
session.findById("wnd[0]/shellcont/shell").pressContextButton "CREATE_ATTA"
session.findById("wnd[0]/shellcont/shell").selectContextMenuItem "PCATTA_CREA"
'Sélectionne fichier de destination
session.findById("wnd[1]/usr/ctxtDY_PATH").Text = "O:\CM-PROC\PROJET ORSID"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").Text = "87580459_22_01_2013.pdf"
End sub
Et tout va bien jusqu'à la lilgne de code "...PCATTA_CREA", mais là SAP attends le chemin d'accès et le nom de fichier malgré les lignes de code suivantes. SAP reste ouvert sur l'écran qui est copie joint...
Une idée quelqu'un ?
Partager