PW@KKI
22nd September 2013, 20:40
Reet then, after many weeks of code, test, code, test, I finally got a working solution that uses a web page to use function servers and create a Sales Quotation in Infor LN.
Here is my basic code:
BaanObj = CreateObject("Baan.Application.default")
BaanObj.Timeout = 60
On Error GoTo BaanAutomationError
'SET FIELDS IN SESSION
Dim type As Type = sqd.[GetType]()
Dim properties As PropertyInfo() = type.GetProperties()
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.qono" & Chr(34) & "," & Chr(34) & Trim("CHK") & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.ofbp" & Chr(34) & "," & Chr(34) & Trim("CUSKEN017") & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.sotp" & Chr(34) & "," & Chr(34) & Trim("CTL") & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.cofc" & Chr(34) & "," & Chr(34) & Trim("AFT") & Chr(34) & ")")
'INSERT RECORD
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.insert(" & Chr(34) & sSession & Chr(34) & ",1," & Chr(34) & sErrMsg & Chr(34) & ")")
If BaanObj.Error <> 0 Or BaanObj.ReturnValue <> "1" Then
Label1.Text = "Error on inserting data:" & vbNewLine & _
"return value = " & ret.ToString() & vbNewLine & _
"BaanObj.Error = " & BaanObj.Error & vbNewLine & _
"BaanObj.ReturnValue = " & BaanObj.ReturnValue & vbNewLine & _
"BaanObj.ReturnCall = " & BaanObj.ReturnCall
Else
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.get.field(" & Chr(34) & _
sSession & Chr(34) & "," & Chr(34) & "tdsls100.qono" & _
Chr(34) & "," & Chr(34) & getfield & Chr(34) & ")")
retCall = BaanObj.ReturnCall
retArea = Mid(retCall, 51, Len(retCall) - 51 - 1)
Label1.Text = "Quote " & retArea & " created successfully!!"
End If
Now, I have trimmed this down a bit , but it works!
I beleive that there are parts of the quotation creation routine that use another session - for example the field Internal Sales Rep is part of session tdsls1500m000 (as modify).
My issue is how to populate data in another session during the quotation creation session.
I have tried additional code:
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.synchronize.dialog(" & Chr(34) & "tdsls1500m000" & Chr(34) & "," & Chr(34) & "add" & Chr(34) & "," & Chr(34) & sErrMsg & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1500m000" & Chr(34) & _
"," & Chr(34) & "tdsls100.crep" & Chr(34) & _
"," & Chr(34) & Trim("1689") & Chr(34) & ")")
Yet again, everything successfully runs through and a quote is created, but the field in the 2nd session is not updated.
I'm obviously doing something wrong, but I have no idea what ....... HELP !!!!!
Thanks,
Paul
Here is my basic code:
BaanObj = CreateObject("Baan.Application.default")
BaanObj.Timeout = 60
On Error GoTo BaanAutomationError
'SET FIELDS IN SESSION
Dim type As Type = sqd.[GetType]()
Dim properties As PropertyInfo() = type.GetProperties()
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.qono" & Chr(34) & "," & Chr(34) & Trim("CHK") & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.ofbp" & Chr(34) & "," & Chr(34) & Trim("CUSKEN017") & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.sotp" & Chr(34) & "," & Chr(34) & Trim("CTL") & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1600m000" & Chr(34) & "," & Chr(34) & "tdsls100.cofc" & Chr(34) & "," & Chr(34) & Trim("AFT") & Chr(34) & ")")
'INSERT RECORD
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.insert(" & Chr(34) & sSession & Chr(34) & ",1," & Chr(34) & sErrMsg & Chr(34) & ")")
If BaanObj.Error <> 0 Or BaanObj.ReturnValue <> "1" Then
Label1.Text = "Error on inserting data:" & vbNewLine & _
"return value = " & ret.ToString() & vbNewLine & _
"BaanObj.Error = " & BaanObj.Error & vbNewLine & _
"BaanObj.ReturnValue = " & BaanObj.ReturnValue & vbNewLine & _
"BaanObj.ReturnCall = " & BaanObj.ReturnCall
Else
BaanObj.ParseExecFunction("ottstpapihand", "stpapi.get.field(" & Chr(34) & _
sSession & Chr(34) & "," & Chr(34) & "tdsls100.qono" & _
Chr(34) & "," & Chr(34) & getfield & Chr(34) & ")")
retCall = BaanObj.ReturnCall
retArea = Mid(retCall, 51, Len(retCall) - 51 - 1)
Label1.Text = "Quote " & retArea & " created successfully!!"
End If
Now, I have trimmed this down a bit , but it works!
I beleive that there are parts of the quotation creation routine that use another session - for example the field Internal Sales Rep is part of session tdsls1500m000 (as modify).
My issue is how to populate data in another session during the quotation creation session.
I have tried additional code:
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.synchronize.dialog(" & Chr(34) & "tdsls1500m000" & Chr(34) & "," & Chr(34) & "add" & Chr(34) & "," & Chr(34) & sErrMsg & Chr(34) & ")")
ret = BaanObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & "tdsls1500m000" & Chr(34) & _
"," & Chr(34) & "tdsls100.crep" & Chr(34) & _
"," & Chr(34) & Trim("1689") & Chr(34) & ")")
Yet again, everything successfully runs through and a quote is created, but the field in the 2nd session is not updated.
I'm obviously doing something wrong, but I have no idea what ....... HELP !!!!!
Thanks,
Paul