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

mark_h
12th March 2007, 12:41
This is the correct form for this post - see if this thread (http://www.baanboard.com/baanboard/showthread.php?t=31085) helps. I did not compare the code. Keep in mind you may need updated objects.

Thomasm
13th March 2007, 09:11
Ralf,

Without having read all the details my suggestion would be to use the standard Baan session to close the production orders, not AFS. That session runs by range and only touches orders that are ready to be closed. So it would be easy enough to just run it manually; when you are done with the previous steps for all orders or at another suitable time.

We run this session in a nightly job for all orders.

Good luck,
/Thomas

ralf@lub
13th March 2007, 09:22
Hi,


@marc: the thread was very usefull for me. It works.

@thomas: I think I didn't choose a good subject fot my question. The problem was to recieve the stoc again when changing the status from active to ready. Every single lot wants to be entered one by one. (tdilc4113s000) When changing items with a stoc of several hundred you are quite busy on that ;-)

Thanks a lot for your answers!

Regards,
Ralf