tbrault
5th March 2002, 10:01
:confused:
Hello, I want to create a program with vb (visual basic) to run session of baan.
In fact, I would want to print item datas (tiitm0401m00) by sending item code with vb. But I don't know how do this?
Can you send me a code example?
PS I use the library : "ottstpapihand"
mark_h
5th March 2002, 15:10
I can not tell you how to run a real Baan session, but I do know that you can write a Baan function server, put that in a DLL and call that from VB.
See this
link (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=1233) for the same VB code. Then you can search on stpapi and see most of the function server questions.
Good Luck!
Mark
tbrault
6th March 2002, 10:30
Hi
I have an another pb : I would want to print with the session "tisfc0408m000". I have created a program, the compilation is ok, but I have not screen that display. Can you help me please.
PS : (I have create program to print Item data and this program run normally)
That's my vb program :
""
Public Function impression_of()
'--> Nouveau parametre, déclaration---------------------------------------
'----> Declaration Session
Dim SessionImpression As String
Dim RapportImpression As String
Dim ErrMessage1 As String
'---> Declaration Champs
Dim OfKey1 As String
Dim OfKey2 As String
Dim DuplicataKey As String
Dim ModifieKey As String
Dim CodeImprimante As String
'----> Declaration variable
Dim OfKeyValue1 As String
Dim OfKeyValue2 As String
Dim DuplicataKeyValue As String
Dim ModifieKeyValue As String
'-------------------------------------------------------------------------
'--> Definition parametre-------------------------------------------------
'----> Definition Session
SessionImpression = "tisfc0408m000"
RapportImpression = "rtisfc040804000"
ErrMessage1 = Space(30)
'----> Definition champs
OfKey1 = "pdno.f"
OfKey2 = "pdno.t"
DuplicataKey = "print.dupl"
ModifieKey = "print.modi"
CodeImprimante = "D"
'----> Definition variable
OfKeyValue1 = "140004"
OfKeyValue2 = "140004"
DuplicataKeyValue = "1"
ModifieKeyValue = "1"
'--------------------------------------------------------------------------
'--> Programme
Set BaanObj = CreateObject("Baan4.Application")
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.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & DuplicataKey & Chr(34) & "," & Chr(34) & DuplicataKeyValue & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & ModifieKey & Chr(34) & "," & Chr(34) & ModifieKeyValue & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.continue.process(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & ErrMessage1 & 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.print.report(" & Chr(34) & SessionImpression & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.end.session(" & Chr(34) & SessionImpression & Chr(34) & ")"
BaanObj.Quit
End Function
""
mark_h
6th March 2002, 15:23
Here is what I did to get it to work.
SessionImpression = "tisfc0408m000"
| Used this report instead because my prod. order
| did not have a material list.
RapportImpression = "rtisfc040801000"
ErrMessage1 = Space(30)
'---> Definition champs
OfKey1 = "pdno.f"
OfKey2 = "pdno.t"
DuplicataKey = "print.dupl"
ModifieKey = "print.modi"
'Used the printer just to make sure.
CodeImprimante = "LOUIR01"
'----> Definition variable
OfKeyValue1 = "300100"
OfKeyValue2 = "300100"
DuplicataKeyValue = "1"
ModifieKeyValue = "1"
Set BaanObj = CreateObject("Baan4.Application")
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) & ")"
'Commented out these lines because my session
' defaults are YES to orig and yes to dup.
'BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," _
'& Chr(34) & DuplicataKey & Chr(34) & "," & Chr(34) & DuplicataKeyValue & Chr(34) & ")"
'BaanObj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & SessionImpression & Chr(34) & "," _
'& Chr(34) & ModifieKey & Chr(34) & "," & Chr(34) & ModifieKeyValue & Chr(34) & ")"
' Must do set report BEFORE CONTINUE
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) & ")"
' Set report not needed.
'BaanObj.ParseExecFunction "ottstpapihand", "stpapi.print.report(" & Chr(34) & SessionImpression & Chr(34) & _
' "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
BaanObj.ParseExecFunction "ottstpapihand", "stpapi.end.session(" & Chr(34) & SessionImpression & Chr(34) _
& ")"
BaanObj.Quit
Sorry my post is not as pretty as yours, but I was in a hurry.
Mark