ralf@lub
12th March 2007, 10:52
Hi,
we want to change all Item of several item groups to tiitm001.kltc = unit (clot administrated).
The procedure is well known, but for items with stoc it's plenty of work. (rework production order, outbound stoc, change item, generade clots, close production order and inbound stoc)
I want to do all these steps with afs. It works fine for the first steps. But I can't close the production order.
The AFS session freezes when I try to handle the subprocess. We don't have the sources for these sessions, so I can just guess the process.
Session tisfc0202m000 seems to zoom to tisfc0507m000 and tisfc0507m000 supposed to open tdilc4113s000.
Is that correct?
Here is some not working code to make it more understandable...
function extern domain tcpono tisfc0201lub00.close.production.order( domain tcpdno pdno,
ref string error.msg) {
long retval1, retval2
domain tdltc.cert cert
string recover.msg(500)
string sessioncode(14), sessioncode1(14), sessioncode2(14)
select tisfc001.*
from tisfc001
where tisfc001.pdno = :pdno
selectdo
selectempty
return(false)
endselect
sessioncode = "tisfc0202m000"
sessioncode1 = "tisfc0507m000"
sessioncode2 = "tdilc4113s000"
stpapi.put.field(sessioncode, "tisfc0101.orno", str$(pdno))
stpapi.put.field(sessioncode, "qdrv.frm", str$(tisfc001.qrdr))
| I played with "add" and "ignore" here. ignore works, but problems occure later then
stpapi.handle.subproc(sessioncode, sessioncode1, "ignore")
stpapi.continue.process(sessioncode, error.msg)
stpapi.enum.answer(sessioncode, "tisfc02029", tcyesno.yes)
stpapi.handle.subproc(sessioncode1, sessioncode2, "add")
| clot is created when documents are printed.
| field cert contains pdno as relation
tt.align.according.domain(str$(pdno), cert, "tdltc.cert")
select tdltc001.clot
from tdltc001
where tdltc001.cert = :cert
selectdo
| with "ignore" it freezes here
stpapi.put.field(sessioncode2, "tdilc402.clot", shiftl$(strip$(tdltc001.clot)))
stpapi.put.field(sessioncode2, "tdilc402.qstr", "1")
retval1 = stpapi.insert(sessioncode2, true, error.msg)
if not retval1 then
message(error.msg)
retval2 = stpapi.recover(sessioncode2, recover.msg)
stpapi.end.session(sessioncode2)
retval1 = stpapi.recover(sessioncode, recover.msg)
stpapi.end.session(sessioncode1)
return(false)
endif
endselect
stpapi.end.session(sessioncode2)
stpapi.end.session(sessioncode1)
stpapi.end.session(sessioncode)
return(true)
}
Anyone who played around with this before or who can tell me the correct order and behavior of the sessions?
Thanks a lot,
Ralf
we want to change all Item of several item groups to tiitm001.kltc = unit (clot administrated).
The procedure is well known, but for items with stoc it's plenty of work. (rework production order, outbound stoc, change item, generade clots, close production order and inbound stoc)
I want to do all these steps with afs. It works fine for the first steps. But I can't close the production order.
The AFS session freezes when I try to handle the subprocess. We don't have the sources for these sessions, so I can just guess the process.
Session tisfc0202m000 seems to zoom to tisfc0507m000 and tisfc0507m000 supposed to open tdilc4113s000.
Is that correct?
Here is some not working code to make it more understandable...
function extern domain tcpono tisfc0201lub00.close.production.order( domain tcpdno pdno,
ref string error.msg) {
long retval1, retval2
domain tdltc.cert cert
string recover.msg(500)
string sessioncode(14), sessioncode1(14), sessioncode2(14)
select tisfc001.*
from tisfc001
where tisfc001.pdno = :pdno
selectdo
selectempty
return(false)
endselect
sessioncode = "tisfc0202m000"
sessioncode1 = "tisfc0507m000"
sessioncode2 = "tdilc4113s000"
stpapi.put.field(sessioncode, "tisfc0101.orno", str$(pdno))
stpapi.put.field(sessioncode, "qdrv.frm", str$(tisfc001.qrdr))
| I played with "add" and "ignore" here. ignore works, but problems occure later then
stpapi.handle.subproc(sessioncode, sessioncode1, "ignore")
stpapi.continue.process(sessioncode, error.msg)
stpapi.enum.answer(sessioncode, "tisfc02029", tcyesno.yes)
stpapi.handle.subproc(sessioncode1, sessioncode2, "add")
| clot is created when documents are printed.
| field cert contains pdno as relation
tt.align.according.domain(str$(pdno), cert, "tdltc.cert")
select tdltc001.clot
from tdltc001
where tdltc001.cert = :cert
selectdo
| with "ignore" it freezes here
stpapi.put.field(sessioncode2, "tdilc402.clot", shiftl$(strip$(tdltc001.clot)))
stpapi.put.field(sessioncode2, "tdilc402.qstr", "1")
retval1 = stpapi.insert(sessioncode2, true, error.msg)
if not retval1 then
message(error.msg)
retval2 = stpapi.recover(sessioncode2, recover.msg)
stpapi.end.session(sessioncode2)
retval1 = stpapi.recover(sessioncode, recover.msg)
stpapi.end.session(sessioncode1)
return(false)
endif
endselect
stpapi.end.session(sessioncode2)
stpapi.end.session(sessioncode1)
stpapi.end.session(sessioncode)
return(true)
}
Anyone who played around with this before or who can tell me the correct order and behavior of the sessions?
Thanks a lot,
Ralf