FoxZapper
31st October 2005, 14:06
Hello,
I am trying to automate the Collect Order Process.
In this, I managed to:
1. create a new sales order header
2. insert new sales order lines.
And when I save the record, the Maintain Outbound Data session (tdilc4102s000) gets activated immediately as its an order of type "Collect Order" [Note: tcmcs0142m000: Maintain Order Type with Collect Order = Yes]
I have already successfully managed to run the Maintain Outbound Process via the Maintain Outbound Data (tdilc4101m000) and the subsequent occurance of the subsession tdils4102s000.
However, in this case, the program fails as I am assuming there are 2 subsessions (tdsls4105s000 and tdilc4102s000) to be activated from the main session Maintain Sales Order tdsls4101m000
Has someone come across this issue?
Any suggestions are welcome.
Regards,
Arun
function insert.so.lines.and.outbound.data()
{
long ret.val, ret.val1, ret.val2, ret.val3
string so.str(8)
string err.mess(132)
string so.number.str(10)
string position.string(5)
get.max.position.for.order()
stpapi.put.field("tdsls4101m000", "tdsls040.orno", so.number.str)
ret.val1 = stpapi.find("tdsls4101m000", error.msg)
if ret.val1 = 1 then
stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.continue.process("tdsls4101m000", error.msg)
stpapi.get.field("tdsls4105s000", "tdsls041.orno", so.str)
stpapi.put.field("tdsls4105s000", "tdsls041.orno", so.number.str)
stpapi.put.field("tdsls4105s000", "tdsls041.pono", position.number.str)
stpapi.put.field("tdsls4105s000", "tdsls041.item", "51209")
stpapi.put.field("tdsls4105s000", "tdsls041.cwar", "001")
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", "1")
stpapi.put.field("tdsls4105s000", "tdsls041.pric", "735")
stpapi.put.field("tdsls4105s000", "tdsls041.ldam", "0")
stpapi.put.field("tdsls4105s000", "tdsls041.disc", "0")
ret.val2 = stpapi.insert("tdsls4105s000", true, err.mesg)
if ret.val2 <> 1 then
|* If error, then recover the session
ret.val3 = stpapi.recover("tdsls4105s000", err.mess)
create.so.insert.err.file()
else
success.rec = success.rec + 1
|* Maintain Outbound Data
stpapi.handle.subproc("tdsls4105s000", "tdilc4102s000", "add")
get.next.sequence.number.for.sales.sera.serb.from.tdilc401()
|* Begin the Subsession to maintain the data
stpapi.put.field( "tdilc4102s000", "tdilc401.koor", str$(etol(tdilc.koob.act.sls)))
stpapi.put.field( "tdilc4102s000", "tdilc401.orno", order.no.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.pono", position.number.str)
ret.val3 = stpapi.change.view("tdilc4102s000", error.msg)
stpapi.put.field( "tdilc4102s000", "tdilc401.orno", order.no.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.pono", position.number.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.sera", sera.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.serb", serb.str)
stpapi.put.field( "tdilc4102s000", "tdsls041.item", "51209")
stpapi.put.field( "tdilc4102s000", "tdilc401.loca", "RE")
stpapi.put.field( "tdilc4102s000", "tdilc401.stun", "set")
stpapi.put.field( "tdilc4102s000", "tdilc401.qstr", "1")
stpapi.put.field( "tdilc4102s000", "tdilc401.qsts", "1")
ret.val = stpapi.insert("tdilc4102s000", true, err.mesg )
if ret.val <> 1 then
ret.val2 = stpapi.recover("tdilc4102s000", err.mess)
|create.err.file()
else
success.rec = success.rec + 1
first.time = false
endif
stpapi.end.session( "tdilc4102s000")
stpapi.end.session( "tdilc4513s000")
endif
stpapi.end.session( "tdsls4105s000")
stpapi.end.session( "tdsls4504s000")
else
|* Order Not found
err.mesg = sprintf$("Sales Order:%s could not be found!!", so.number.str)
create.so.insert.err.file()
endif
stpapi.end.session( "tdsls4101m000")
}
I am trying to automate the Collect Order Process.
In this, I managed to:
1. create a new sales order header
2. insert new sales order lines.
And when I save the record, the Maintain Outbound Data session (tdilc4102s000) gets activated immediately as its an order of type "Collect Order" [Note: tcmcs0142m000: Maintain Order Type with Collect Order = Yes]
I have already successfully managed to run the Maintain Outbound Process via the Maintain Outbound Data (tdilc4101m000) and the subsequent occurance of the subsession tdils4102s000.
However, in this case, the program fails as I am assuming there are 2 subsessions (tdsls4105s000 and tdilc4102s000) to be activated from the main session Maintain Sales Order tdsls4101m000
Has someone come across this issue?
Any suggestions are welcome.
Regards,
Arun
function insert.so.lines.and.outbound.data()
{
long ret.val, ret.val1, ret.val2, ret.val3
string so.str(8)
string err.mess(132)
string so.number.str(10)
string position.string(5)
get.max.position.for.order()
stpapi.put.field("tdsls4101m000", "tdsls040.orno", so.number.str)
ret.val1 = stpapi.find("tdsls4101m000", error.msg)
if ret.val1 = 1 then
stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.continue.process("tdsls4101m000", error.msg)
stpapi.get.field("tdsls4105s000", "tdsls041.orno", so.str)
stpapi.put.field("tdsls4105s000", "tdsls041.orno", so.number.str)
stpapi.put.field("tdsls4105s000", "tdsls041.pono", position.number.str)
stpapi.put.field("tdsls4105s000", "tdsls041.item", "51209")
stpapi.put.field("tdsls4105s000", "tdsls041.cwar", "001")
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", "1")
stpapi.put.field("tdsls4105s000", "tdsls041.pric", "735")
stpapi.put.field("tdsls4105s000", "tdsls041.ldam", "0")
stpapi.put.field("tdsls4105s000", "tdsls041.disc", "0")
ret.val2 = stpapi.insert("tdsls4105s000", true, err.mesg)
if ret.val2 <> 1 then
|* If error, then recover the session
ret.val3 = stpapi.recover("tdsls4105s000", err.mess)
create.so.insert.err.file()
else
success.rec = success.rec + 1
|* Maintain Outbound Data
stpapi.handle.subproc("tdsls4105s000", "tdilc4102s000", "add")
get.next.sequence.number.for.sales.sera.serb.from.tdilc401()
|* Begin the Subsession to maintain the data
stpapi.put.field( "tdilc4102s000", "tdilc401.koor", str$(etol(tdilc.koob.act.sls)))
stpapi.put.field( "tdilc4102s000", "tdilc401.orno", order.no.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.pono", position.number.str)
ret.val3 = stpapi.change.view("tdilc4102s000", error.msg)
stpapi.put.field( "tdilc4102s000", "tdilc401.orno", order.no.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.pono", position.number.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.sera", sera.str)
stpapi.put.field( "tdilc4102s000", "tdilc401.serb", serb.str)
stpapi.put.field( "tdilc4102s000", "tdsls041.item", "51209")
stpapi.put.field( "tdilc4102s000", "tdilc401.loca", "RE")
stpapi.put.field( "tdilc4102s000", "tdilc401.stun", "set")
stpapi.put.field( "tdilc4102s000", "tdilc401.qstr", "1")
stpapi.put.field( "tdilc4102s000", "tdilc401.qsts", "1")
ret.val = stpapi.insert("tdilc4102s000", true, err.mesg )
if ret.val <> 1 then
ret.val2 = stpapi.recover("tdilc4102s000", err.mess)
|create.err.file()
else
success.rec = success.rec + 1
first.time = false
endif
stpapi.end.session( "tdilc4102s000")
stpapi.end.session( "tdilc4513s000")
endif
stpapi.end.session( "tdsls4105s000")
stpapi.end.session( "tdsls4504s000")
else
|* Order Not found
err.mesg = sprintf$("Sales Order:%s could not be found!!", so.number.str)
create.so.insert.err.file()
endif
stpapi.end.session( "tdsls4101m000")
}