gous99
6th September 2002, 16:59
Hi all,

I am trying to automate the process of creating a production order and then do the print order document and release.

We are on Baan c3 A&D 22b0

Everything goes smooth up until the Print Order Document and Release.

Here is my code for this part,

stpapi.handle.subproc("tisfc0101m000", "tisfc0205s000", "add")
stpapi.handle.subproc("tisfc0205s000", "tisfc0408s000", "add")
stpapi.zoom.option("tisfc0101m000", 1, "tisfc0205s000", gapi.error.code)

I followed the script with afs.log, here it goes, it handle the process for tisfc0205s000 (wich is only a form with no fields, all the code, zooming to tisfc0408s000 and tisfc0204s000 is in the form.1, init.form event).

Then, in the afs.log we see it does the handle sub process to tisfc0408s000, but (I compiled the script tisfc0205s000 in debug) then without any warning it starts the session tisfc0205s000, and when it gets the zoom.to$ tisfc0408s000 it hangs there forever????

Here is the code from tisfc0205s000,

form.1: |EV#12031-1
init.form: |EV#12031-1
import("new.order.no",new.order.no)
export("new.order.no",new.order.no)
zoom.to$("tisfc0408s000",z.session,"","",0) zoom.to$("tisfc0204s000",z.session,"tisfc0205s000","",0)
end()

Any ideas for this problem....

mark_h
6th September 2002, 18:20
The way I did this was a little different. I did have a GRP Production order to transfer. So I confirm, transfer and print. I used nothing but main sessions - no sub-sessions or zooming. So you may want to try using tisfc0101m000 to create the production order. Then use tisfc0205m000 to release the production order. Then tisfc0408m000 to print the order documents. Then you do not have to worry about controlling sub-sessions.

Good Luck!

Mark

mark_h
6th September 2002, 18:23
I forgot to add that there have been multiple problems discussed here with sub-sessions that auto start another sub-session. Plus there also some problems with session that end automatically also. That is why I suggessted using main sessions versus sub-sessions. I know it would be easier to start one session and do it all, but the coding is probably about the same using either method.

Mark

gous99
6th September 2002, 20:42
Mark,

I did start to work on the main session tisfc0408m000, you seem to mention you created an AFS for it?

I putting my values, but it never prints saying no data within range; hence no action taken, it seems like it doesn't pass my parameter to the session?

After doing my put, I do get on my fields, the value is good, but it does not seem to carry in the actual session?

mark_h
6th September 2002, 20:59
I used ttstpcreatdll to generate a library. Here is the code:

function print_production_order()
{
spool.device = ""
spool.fileout = ""
sfc.order = val(sfc.order.string)
| Setup report.
rprt.id = spool.open("rProd. Order",spool.device,1)
if(rprt.id = 0) then
mess.3="Printing Cancelled."
display.all()
return
endif
| Put the fields.
f0408m000.put.Project_Group_to("ZZZ")
f0408m000.put.Production_order_from(sfc.order)
f0408m000.put.Production_order_to(sfc.order)
f0408m000.put.To_Production_Date(tipgc510.psdt)
f0408m000.put._Originals(tcyesno.yes)
f0408m000.put._Duplicates(tcyesno.yes)
f0408m000.put._Modified(tcyesno.yes)

| Set report
stpapi.set.report("tisfc0408m000","rtisfc040801000",spool.device,errmsg)
if(strip$(errmsg)<>"") then
message("Report: "&errmsg)
else
f0408m000.continue(errmsg)
if(strip$(errmsg)<>"") then
message("Continue: "&errmsg)
endif
mess.3 = "Production Order Printed."
display.all()
endif
| Close the spooler for the next device and report.
spool.close()
| Kill the session.
f0408m000.end()
}

You probably do not need the project group and you should probably make sure the production date is out far enough. You may also want to post your code that might help someone else see what is wrong.

Mark

(And yes ~Vamsi it still has strip$ in it. I no longer use this code and its Gordons fault anyway. He used it first in his code) :)

gfasbender
6th September 2002, 21:35
Mark,
Leave me out of this! You know you can modify any code you've requisitioned from me... Anyway, I kind of like the word "strip".

mark_h
6th September 2002, 21:50
Your posting off topic. Cut it out. I followed your lead anyway. :)

I wonder if moderators can get away with this. At least on Fridays :)


Mark