psehouri
19th March 2008, 11:40
Hello,
If I use this vbscript code below to print 15L units via : tcmcs0401m000 and everything works fine.
Dim SessionImpression
Dim RapportImpression
Dim ErrMessage1
Dim OfKey1
Dim OfKey2
Dim OfKeyValue1
Dim OfKeyValue2
Dim CodeImprimante
SessionImpression = "tcmcs0401m000"
RapportImpression = "rtcmcs040101000"
ErrMessage1 = Space(30)
OfKey1 = "cuni.f"
OfKey2 = "cuni.t"
CodeImprimante = "L"
OfKeyValue1 = "15L"
OfKeyValue2 = "15L"
Set BaanObj = CreateObject("Baan4.Application.510")
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & OfKey1 & Chr(34) & "," & Chr(34) & OfKeyValue1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & OfKey2 & Chr(34) & "," & Chr(34) & OfKeyValue2 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.set.report(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & RapportImpression & Chr(34) & "," & Chr(34) & CodeImprimante & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.continue.process(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.end.session(" & Chr(34) & SessionImpression & Chr(34) & ")"
BaanObj.Quit
If I want to do the same using Python using the code below, I get a BW Message saying :
DispInvoke Failed, error = -2147352573
So, the session works, but I can't quit the session automatically because of the BW Message...
Someone already experience and solve this problem ???
Than'x...
import win32com.client
Societe = "510"
LanceBaaN = "Baan4.Application." + Societe
SessionImpression = "tcmcs0410m000"
RapportImpression = "rtcmcs041001000"
ErrMessage1 = ""
OfKey1 = "ccty.f"
OfKey2 = "ccty.t"
CodeImprimante = "L-PAYSAGE"
OfKeyValue1 = "FRA"
OfKeyValue2 = "FRA"
BaanObj = win32com.client.Dispatch(LanceBaaN)
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + OfKey1 + chr(34) + "," + chr(34) + OfKeyValue1 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + OfKey2 + chr(34) + "," + chr(34) + OfKeyValue2 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.set.report(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + RapportImpression + chr(34) + "," + chr(34) + CodeImprimante + chr(34) + "," + chr(34) + ErrMessage1 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.continue.process(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + ErrMessage1 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.end.session(" + chr(34) + SessionImpression + chr(34) + ")")
BaanObj.Quit
If I use this vbscript code below to print 15L units via : tcmcs0401m000 and everything works fine.
Dim SessionImpression
Dim RapportImpression
Dim ErrMessage1
Dim OfKey1
Dim OfKey2
Dim OfKeyValue1
Dim OfKeyValue2
Dim CodeImprimante
SessionImpression = "tcmcs0401m000"
RapportImpression = "rtcmcs040101000"
ErrMessage1 = Space(30)
OfKey1 = "cuni.f"
OfKey2 = "cuni.t"
CodeImprimante = "L"
OfKeyValue1 = "15L"
OfKeyValue2 = "15L"
Set BaanObj = CreateObject("Baan4.Application.510")
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & OfKey1 & Chr(34) & "," & Chr(34) & OfKeyValue1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & OfKey2 & Chr(34) & "," & Chr(34) & OfKeyValue2 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.set.report(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & RapportImpression & Chr(34) & "," & Chr(34) & CodeImprimante & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.continue.process(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.end.session(" & Chr(34) & SessionImpression & Chr(34) & ")"
BaanObj.Quit
If I want to do the same using Python using the code below, I get a BW Message saying :
DispInvoke Failed, error = -2147352573
So, the session works, but I can't quit the session automatically because of the BW Message...
Someone already experience and solve this problem ???
Than'x...
import win32com.client
Societe = "510"
LanceBaaN = "Baan4.Application." + Societe
SessionImpression = "tcmcs0410m000"
RapportImpression = "rtcmcs041001000"
ErrMessage1 = ""
OfKey1 = "ccty.f"
OfKey2 = "ccty.t"
CodeImprimante = "L-PAYSAGE"
OfKeyValue1 = "FRA"
OfKeyValue2 = "FRA"
BaanObj = win32com.client.Dispatch(LanceBaaN)
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + OfKey1 + chr(34) + "," + chr(34) + OfKeyValue1 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + OfKey2 + chr(34) + "," + chr(34) + OfKeyValue2 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.set.report(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + RapportImpression + chr(34) + "," + chr(34) + CodeImprimante + chr(34) + "," + chr(34) + ErrMessage1 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.continue.process(" + chr(34) + SessionImpression + chr(34) + "," + chr(34) + ErrMessage1 + chr(34) + ")")
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.end.session(" + chr(34) + SessionImpression + chr(34) + ")")
BaanObj.Quit