monica1
8th April 2005, 14:29
In session tfcmg2131s000 (Assign Advance / Unallocated Payments to Invoices) when you execute cont.process the session run tfcmg2106s000 (Assign Unallocated/Advance Payments to Invoices).

I try to automatize this session but how can I controle the records in the second session. It's possible?

If I want if to make automatically assignments for an invoice.


stpapi.put.field("tfcmg2131s000", "tfacp200.ifbp", catmp028.ifbp)
stpapi.put.field("tfcmg2131s000", "tfacp200.ttyp", catmp028.ttyp)
stpapi.put.field("tfcmg2131s000", "tfacp200.ninv", str$(catmp028.ninv))
stpapi.put.field("tfcmg2131s000", "tfacp200.line", str$(catmp028.line))
ret = stpapi.find("tfcmg2131s000", mensaje)
if ret = 1 then
|** marcamos el registro que tenemos en la catmp028
ret = stpapi.mark("tfcmg2131s000", mensaje)
if ret = 1 then
|** desde esta sesión ejecutamos el cont.process
stpapi.form.command("tfcmg2131s000", 5 "exec.cont.process" , mensaje) endif
endif
stpapi.end.session("tfcmg2131s000")




Thank you in advance,

mark_h
8th April 2005, 16:14
Monica,

It should be as easy as adding a stpapi.handle.subproc right before the continue. It would look something like this:

stpapi.handle.subproc("tfcmg2131s000","tfcmg2106s000","add")

In effect this should bring tfcmg2106s000 under control of your program. At the point you should be able to manipulate the tfcmg2106s000 program with the stpapi commands - just like running it manually. Sometimes getting control of sub-sessions like this is more difficult than it looks. I have not done one for these sessions, but in theory it should work.

monica1
21st April 2005, 12:13
Thank you very much for your reply.
I try with stpapi.handle.subproc() and it works fine, but in the session I get the control with this function I have set.synchronized.dialog("tfcmg2119s000")
In the normal process I double click on a document and the program go to choice.modify.set and then open the session tfcmg2119s000, but I don't know how to do this with AFS. I try with this but it open the session but don't go to choice modify.set. How can I do that?


......
stpapi.put.field("tfcmg2106s002", "tfcmg206.bpid", catmp028.ifbp)
stpapi.put.field("tfcmg2106s002", "tfcmg206.comp", str$(company))
stpapi.put.field("tfcmg2106s002", "tfcmg206.ttyp", acp.ttyp)
stpapi.put.field("tfcmg2106s002", "tfcmg206.ninv", str$(acp.ninv))
ret = stpapi.mark("tfcmg2106s002", mensaje)
if ret = 1 then
ret = stpapi.synchronize.dialog("tfcmg206s002", "modify",
mensaje)
if ret then
stpapi.put.field("tfcmg2119s000", "tfcmg206.type",
str$(etol(tfcmg.rcpt.automatic)))
ret = stpapi.update("tfcmg2119s000", true, mensaje)
endif
stpapi.end.session("tfcmg2119s000")
........
endif
stpapi.end.session("tfcmg2106s000")
....


The message that returns stpapì.synchronize.dialog() is "Command disabled".


Thank you in advance,

mark_h
22nd April 2005, 20:48
Oops missed this post. Not sure I can help since this is Baan V stuff. So is tfcmg2106s002 the multi-occurence session and tfmcg2119s000 the single occ session? From what I read on the stpapi.synchronize.dialog you first find the record - plus I would expect a find before a stpapi.mark. So maybe it needs to be ret = stpapi.find("tfcmg2106s002", mensaje) first. Since I am not familiar with these sessions I can only guess.

It may be that you need to a find in session tfcmg2106s002 first, then a continue, with a stpapi.handle.subproc before the continue. Then when tfcmg9119s000 comes up the update would work. Remember I am just guessing and I may not be able to help at all.

monica1
25th April 2005, 09:21
Thank you very much. When I write spapi.find() it works fine.