fallguyjg
16th August 2005, 00:06
Baan Friends,
I'm creating a sales line via AFS, and I'm wanting to set the sales line position.
But the sales line position is auto generated, and ignores my assigned position.
I have form fields orno.f and pono.f
When I set the pono.f = 10, it ignores this value and creates a sales line with the next position (in my case, increment by 1).
Here's my code:
#define FAIL (err.cde = false)
#define NOT_FOUND (err.cde <> 1)
function insert.sline()
{
| find sales header
stpapi.clear("tdsls4101m000")
stpapi.put.field("tdsls4101m000", "tdsls040.orno", str$(orno.f))
err.cde = stpapi.find("tdsls4101m000", err.msg)
if FAIL then
stpapi.get.mess.code("tdsls4101m000", err.msg)
if isspace(err.msg) then
err.msg = "Record Not Found"
endif
while not isspace(err.msg)
message("%s", err.msg)
stpapi.get.mess.code("tdsls4101m000", err.msg)
endwhile
stpapi.recover("tdsls4101m000", err.msg)
stpapi.end.session("tdsls4101m000", err.msg)
return
endif
if NOT_FOUND then
message("Record Not Found")
stpapi.end.session("tdsls4101m000", err.msg)
return
endif
| add sales line
stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.clear("tdsls4105s000")
stpapi.continue.process("tdsls4101m000", err.msg)
stpapi.put.field("tdsls4105s000", "tdsls041.pono", str$(pono.f))
stpapi.put.field("tdsls4105s000", "tdsls041.item", item.f)
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", str$(oqua.f))
stpapi.put.field("tdsls4105s000", "tdsls041.pric", str$(pric.f))
err.cde = stpapi.insert("tdsls4105s000", true, err.msg)
if FAIL then
stpapi.get.mess.code("tdsls4105s000", err.msg)
while not isspace(err.msg)
message("%s", err.msg)
stpapi.get.mess.code("tdsls4105s000", err.msg)
endwhile
stpapi.recover("tdsls4105s000", err.msg)
stpapi.end.session("tdsls4105s000", err.msg)
stpapi.end.session("tdsls4101m000", err.msg)
return
endif
stpapi.get.field("tdsls4105s000", "tdsls041.orno", orno)
stpapi.get.field("tdsls4105s000", "tdsls041.pono", pono)
stpapi.end.session("tdsls4105s000", err.msg)
stpapi.end.session("tdsls4101m000", err.msg)
message("Sales Order Line: %s / %s Created", orno, pono)
}
Anyone have any ideas on this?
Thanks,
fallguyjg
I'm creating a sales line via AFS, and I'm wanting to set the sales line position.
But the sales line position is auto generated, and ignores my assigned position.
I have form fields orno.f and pono.f
When I set the pono.f = 10, it ignores this value and creates a sales line with the next position (in my case, increment by 1).
Here's my code:
#define FAIL (err.cde = false)
#define NOT_FOUND (err.cde <> 1)
function insert.sline()
{
| find sales header
stpapi.clear("tdsls4101m000")
stpapi.put.field("tdsls4101m000", "tdsls040.orno", str$(orno.f))
err.cde = stpapi.find("tdsls4101m000", err.msg)
if FAIL then
stpapi.get.mess.code("tdsls4101m000", err.msg)
if isspace(err.msg) then
err.msg = "Record Not Found"
endif
while not isspace(err.msg)
message("%s", err.msg)
stpapi.get.mess.code("tdsls4101m000", err.msg)
endwhile
stpapi.recover("tdsls4101m000", err.msg)
stpapi.end.session("tdsls4101m000", err.msg)
return
endif
if NOT_FOUND then
message("Record Not Found")
stpapi.end.session("tdsls4101m000", err.msg)
return
endif
| add sales line
stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.clear("tdsls4105s000")
stpapi.continue.process("tdsls4101m000", err.msg)
stpapi.put.field("tdsls4105s000", "tdsls041.pono", str$(pono.f))
stpapi.put.field("tdsls4105s000", "tdsls041.item", item.f)
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", str$(oqua.f))
stpapi.put.field("tdsls4105s000", "tdsls041.pric", str$(pric.f))
err.cde = stpapi.insert("tdsls4105s000", true, err.msg)
if FAIL then
stpapi.get.mess.code("tdsls4105s000", err.msg)
while not isspace(err.msg)
message("%s", err.msg)
stpapi.get.mess.code("tdsls4105s000", err.msg)
endwhile
stpapi.recover("tdsls4105s000", err.msg)
stpapi.end.session("tdsls4105s000", err.msg)
stpapi.end.session("tdsls4101m000", err.msg)
return
endif
stpapi.get.field("tdsls4105s000", "tdsls041.orno", orno)
stpapi.get.field("tdsls4105s000", "tdsls041.pono", pono)
stpapi.end.session("tdsls4105s000", err.msg)
stpapi.end.session("tdsls4101m000", err.msg)
message("Sales Order Line: %s / %s Created", orno, pono)
}
Anyone have any ideas on this?
Thanks,
fallguyjg