earizmendi
23rd May 2007, 20:28
Hi Everybody,

I'm working with my second AFS program, trying to complete the automatization of 1 session and 4 subsessions:

tfgld9110m000 (our version of tfgld1100m000)
tfgld1101s000
tfcmg2100s000 (Maintain Bank Transactions)
tfcmg2102s000(Reconciliation of anticipated payments/receipts)
tfcmg2103s000(Reconciliation of payments/receipts)


everything working fine until trying to open/handle the tfcmg2102s000 subsession, when the program execute the line "retval = stpapi.insert("tfcmg2100s000",true,error.msg)" its hangs.

Executing manually the process, the session tfcmg2102s000 its open when you save the record in tfcmg2100s000, maybe i have to do something else...

Please give some help with this, i insert the code...

thks!!!

| stpapi.put.field("tfgld9110m000","tfgld100.tedt",num.to.date$(date.num(),2))

stpapi.put.field("tfgld9110m000","tfgld100.tedt",str$(date.num()))

stpapi.put.field("tfgld9110m000","tfgld100.year",str$(year))
stpapi.put.field("tfgld9110m000","tfgld100.bref","AFS en Mantener Asientos")
stpapi.put.field("tfgld9110m000","tfgld100.fprd",str$(mont))
stpapi.put.field("tfgld9110m000","tfgld100.rprd",str$(mont))
stpapi.put.field("tfgld9110m000","tfgld100.vprd",str$(mont))

retval = stpapi.insert("tfgld9110m000",true,error.msg)

if not retval then
retval = stpapi.recover("tfgld9110m000", error.msg)
else
stpapi.save("tfgld9110m000",error.msg)


stpapi.handle.subproc("tfgld9110m000","tfgld1101s000","add")
stpapi.continue.process("tfgld9110m000",error.msg)
stpapi.put.field("tfgld1101s000","tfgld101.ttyp","B08")

| stpapi.continue.process("tfgld1101s000",error.msg)

retval = stpapi.insert("tfgld1101s000",true,error.msg)


| retval = stpapi.save("tfgld1101s000",error.msg)

if not retval then
retval = stpapi.recover("tfgld1101s000", error.msg)
else
stpapi.handle.subproc("tfgld1101s000","tfcmg2100s000","add")
stpapi.continue.process("tfgld1101s000",error.msg)

stpapi.put.field("tfcmg2100s000","tfcmg204.docn","0")
stpapi.put.field("tfcmg2100s000","tfcmg204.docd",str$(date.num()))
stpapi.put.field("tfcmg2100s000","tfcmg204.ccur"," MN")
stpapi.put.field("tfcmg2100s000","tfcmg204.tran",str$(etol(tfcmg.tran.reconc.suppl)))

retval = stpapi.insert("tfcmg2100s000",true,error.msg)

stpapi.handle.subproc("tfcmg2100s000","tfcmg2102s000","add")
stpapi.continue.process("tfcmg2100s000",error.msg)
stpapi.put.field("tfcmg2102s000","tfcmg110.bank","R08")
stpapi.put.field("tfcmg2102s000","tfcmg110.tdoc","PC1")
stpapi.put.field("tfcmg2102s000","tfcmg110.pdoc","1724")


retval = stpapi.find("tfcmg2102s000",error.msg)

if retval then
stpapi.handle.subproc("tfcmg2102s000","tfcmg2103s000","add")
stpapi.continue.process("tfcmg2102s000",error.msg)

stpapi.put.field("tfcmg2103s000","bank.stpd",str$(etol(tfcmg.stpd.complete)))
stpapi.continue.process("tfcmg2103s000",error.msg)

stpapi.end.session("tfcmg2103s000")
endif

| retval = stpapi.insert("tfcmg2100s000",true,error.msg)

stpapi.end.session("tfcmg2102s000")


| retval = stpapi.save("tfgld1101s000",error.msg)
if not retval then
retval = stpapi.recover("tfcmg2100s000", error.msg)
else

endif
stpapi.end.session("tfcmg2100s000")
endif


stpapi.end.session("tfgld1101s000")
endif

stpapi.end.session("tfgld9110m000")


}

mark_h
23rd May 2007, 22:25
If the savein tfcmg2100s00 activates the tfcmg2102s000 session then I would expect this code:

retval = stpapi.insert("tfcmg2100s000",true,error.msg)
stpapi.handle.subproc("tfcmg2100s000","tfcmg2102s000","add")

should be

stpapi.handle.subproc("tfcmg2100s000","tfcmg2102s000","add")
retval = stpapi.insert("tfcmg2100s000",true,error.msg)

In debug mode does tfcmg2102s000 get activate when the insert command is activated? I also notice you said "Executing manually the process, the session tfcmg2102s000 its open when you save the record in tfcmg2100s000" - yet your code has an insert. You could also try the stpapi.save command.

earizmendi
25th May 2007, 01:18
You Rigth Mark!!, before the session it opens must be handled... problem solved!!!

earizmendi
25th May 2007, 01:19
Sorry Mark, thks for your advice!!!!

tnzabo
6th March 2008, 22:34
Hi - I was wondering if you would willing to post the rest of your code for how you got the status on the payment document set to complete. I have already done this code ret = stpapi.insert("tfcmg2100s000",true,error.msg)

stpapi.put.field("tfcmg2102s000","tfcmg110.bank","CIT")
stpapi.put.field("tfcmg2102s000","tfcmg110.tdoc","ANP")
|I need to put the check num - I don't know the ANP doc number
stpapi.put.field("tfcmg2102s000","tfcmg110.cheq",rec.check.no)

ret = stpapi.find("tfcmg2102s000",error.msg)
if ret then
stpapi.handle.subproc("tfcmg2102s000","tfcmg2103s000","add")
stpapi.continue.process("tfcmg2102s000",error.msg)
stpapi.put.field("tfcmg2103s000","bank.stpd",str$(etol(tfcmg.stpd.complete)))

stpapi.continue.process("tfcmg2103s000",error.msg)

stpapi.end.session("tfcmg2103s000")

but it doesn't seem to save that status as my check is still showing open. Also - did you get this to work for several checks - I would imagine you did, I'm just not sure where to put the loop in.

Thanks!! Nikkiz

mark_h
6th March 2008, 23:14
My first question is - is there an error message? Or anything to indicate why it would not complete. To me the code looks identical and should work, which leads me to a suspicion that you might need an updated object. Looks like the original poster was on 4c4 and you are on 4c3 - which may (or may not) have different objects and be the cause of the problem. Not a good answer, but it may be the problem.

tnzabo
7th March 2008, 15:06
Thanks for the reply. I'm sorry - I thought I had updated my profile - We recently went live in Dec '07 on Baan IVc4 SP 22 I think so we're pretty up to date. I believe I found an issue with my code - I'm finding the check number and the check number I'm feeding it out of my file has leading zeros so - I don't think it is finding the check.

Does shiftl$ get rid of leading zeros? I found a thread that said that but I tried and it didn't seem to work.

I'm also wondering how to clear more than one check - I have an idea how to loop through it but I'm not sure how with all the sub sessions involved in this.

thanks - NikkiZ

mark_h
7th March 2008, 16:19
Shiftl gets rid of leading spaces. If you want to get rid of leading zero's then just convert to a number first - I think I do something like this for some report; str$(val(chk_number)). This will only work for something like a check number - I think to get rid of leading 0's on partnumbers I had to write a little routine.

tnzabo
7th March 2008, 20:06
man - I can't get this. I was able to get the check number with no leading spaces that's fine but I can't get that pymt doc status set from Open to complete. It goes through the steps and ends the session tfcmg2103s000 but my check is still showing open. I am not getting any errors.

**** UPDATE - GOT IT!! I ADDED AN stpapi.update statement after the put.field and all is well. Thanks!!!