baan2tm0
16th April 2005, 09:59
:D hello people,

its me again.. do you guys have an idea on how to set the position number when inserting the sales order lines with AFS? :rolleyes: it doesn't seem to work even if the set the value, for e.g. if i set it to 200, the line gets inserted but it still follows the last sequence of the last line. there are no problems with the distribution parameters because i am able to do an insert manually with the same(200) position number. :confused: here is a part of my code:


BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.orno" & _
Chr(34) & "," & Chr(34) & OrderNo & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.pono" & _
Chr(34) & "," & Chr(34) & PositionNo & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.item" & _
Chr(34) & "," & Chr(34) & ItemCode & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.opol" & _
Chr(34) & "," & Chr(34) & "1" & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.oqua" & _
Chr(34) & "," & Chr(34) & OrdQty & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.insert(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & ",1," & Chr(34) & sFunctionCall & Chr(34) & ")")


Many thanks in advance

baan2tm0
18th April 2005, 09:54
Hey weird but I finally made a work around. What I did was I set 0 the do_update parameter of the insert function. And then set the position number to whatever i wanted and then call an update function with do_update parameter set to 1.



BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.orno" & _
Chr(34) & "," & Chr(34) & OrderNo & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.item" & _
Chr(34) & "," & Chr(34) & ItemCode & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.opol" & _
Chr(34) & "," & Chr(34) & "1" & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.oqua" & _
Chr(34) & "," & Chr(34) & OrdQty & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.insert(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & ",0," & Chr(34) & sFunctionCall & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.put.field(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & "," & Chr(34) & "tdsls041.pono" & _
Chr(34) & "," & Chr(34) & PositionNo & Chr(34) & ")")

BaaNObj.ParseExecFunction("ottstpapihand", "stpapi.update(" & Chr(34) & _
"tdsls4102s000" & Chr(34) & ",1," & Chr(34) & sFunctionCall & Chr(34) & ")")