jojovalenton
22nd March 2014, 06:05
Hello,

Need help on how call session specific commands from AFS script for example I want to run Release Orders... (Ctrl+Shift+R) from tisfc0501m000 specific?

Thanks,

Jojo

sachinbaan
22nd March 2014, 07:37
hi,

You can use

stpapi.form.command("tisfc0501m000 ", 5 ,"Release Orders", error.message)

where
1st argument : Session name
2nd Argument : 2 or 5 : 2 for session and 5 for function
3rd argument : function or sessioon name
4th argument : error message

jojovalenton
22nd March 2014, 16:42
hello,

Thanks for the reply and now its calling the release order session but the report can't be recognized bec I dont know how to select report from LN report dialog box in afs script.

regards,

jojo

mark_h
23rd March 2014, 19:01
Use stpapi.set.report command. You just need the report defined before the AFS command that starts the report generating.

sachinbaan
24th March 2014, 07:13
use stpapi.set.report("tppin4200m000", "rtppin420001000", "D", error.msg)

where
1st Args: Session name
2nd Args: Report Code
3rd arg : Device
4th arg: Error message

sachinbaan
24th March 2014, 07:16
To Print The Report For Which You Set the report:
use this command
stpapi.continue.process("ttstpsplopen",err)

jojovalenton
24th March 2014, 08:32
hello,

thanks for all the replies, really appreciated but one error message still appearing "report name not filled" but it's filled up in the afs script:

function afs.run.tisfc002.1(
domain tcpdno sfc.pdno.afs)
{ |release production order
domain tcmcs.str100 error.msg
long ret1
error.msg = ""
domain tcyesno print.process, print.error, check.shortages, shortage.report, interactive
|* AFS Script
stpapi.put.field("tisfc0501m000","tisfc001.pdno",sfc.pdno.afs)
ret1 = stpapi.find("tisfc0501m000",error.msg)
if ret1 = 1 then
stpapi.form.command("tisfc0501m000", 2, "tisfc0204m000", error.msg) |session

stpapi.put.field("tisfc0204m000","pdno.f.segment.1",sfc.pdno.afs)
stpapi.put.field("tisfc0204m000","pdno.t.segment.2",sfc.pdno.afs)
stpapi.put.field("tisfc0204m000","cwar.f.segment.1","")
stpapi.put.field("tisfc0204m000","cwar.t.segment.2","~~~~~~")
stpapi.put.field("tisfc0204m000","cwoc.f.segment.1","")
stpapi.put.field("tisfc0204m000","cwoc.t.segment.2","~~~~~~")
stpapi.put.field("tisfc0204m000","prdt.f.segment.1",str$(0))
stpapi.put.field("tisfc0204m000","prdt.t.segment.2",str$(utc.num()))
stpapi.put.field("tisfc0204m000","pldt.f.segment.1",str$(0))
stpapi.put.field("tisfc0204m000","pldt.t.segment.2",str$(utc.num()))
stpapi.put.field("tisfc0204m000","item.f.segment.1","")
stpapi.put.field("tisfc0204m000","item.t.segment.2","~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
stpapi.put.field("tisfc0204m000","check.shortages",str$(etol(tcyesno.yes)))
stpapi.put.field("tisfc0204m000","interactive",str$(etol(tcyesno.yes)))
stpapi.put.field("tisfc0204m000","shortage.report",str$(etol(tcyesno.yes)))
stpapi.put.field("tisfc0204m000","print.process",str$(etol(tcyesno.yes)))
stpapi.set.report("tisfc0204m000","rtisfc020401000","N", error.msg)
stpapi.continue.process("ttstpsplopen",error.msg)
stpapi.put.field("tisfc0204m000","print.error",str$(etol(tcyesno.yes)))
stpapi.set.report("tisfc0204m000","rtisfc020402000","N",error.msg)
stpapi.continue.process("ttstpsplopen",error.msg)
stpapi.form.command("tisfc0204m000", 5, "exec.cont.process",error.msg) |function

if not isspace(error.msg) then
message(error.msg)
endif
endif
}


regards,

jojo

mark_h
24th March 2014, 15:00
What version of baan is this?

My first guess is this not 4c4 so I would expect to see:

stpapi.set.report("tisfc0204m000","rtisfc020401000","N", error.msg)
stpapi.form.command("tisfc0204m000", 5, "exec.cont.process",error.msg) |function

That is assuming you have a spool.device named "N".


My second comment is that from looking at the code is that if it is like release outbound then you can only run 1 report at a time. What we do in release outbound - is print only the shortage report. Then we run the print outbound session and print all the other reports. I would say set everything to NO and see if the order releases. Then set only one report to yes (make sure the correct report number is in the stpapi.set.report) and see if it still works.

Another thing to try - don't zoom to tisfc0204m000 from tisfc0501m000. It looks like tisfc0204m000 is a main session. Just put the production order number in and run it. Not reason to use it as a subsession if it can be run as the main session.

jojovalenton
26th March 2014, 07:56
Thanks Mark for the reply, I'm using FP7 - integ 6.2. I used all the advised scripts send in to this issue but I still don't know why the message 'report name not filled' appear. Any additional help advise is welcome. Thanks.

jojo

mark_h
26th March 2014, 14:54
I won't be much help with LN. If it was 4c4 this is exactly how I would test it. I would call the session directly and make sure I had the correct report number for the error report. I would not zoom from another session.


stpapi.put.field("tisfc0204m000","pdno.f.segment.1",sfc.pdno.afs)
stpapi.put.field("tisfc0204m000","pdno.t.segment.2",sfc.pdno.afs)
stpapi.put.field("tisfc0204m000","prdt.f.segment.1",str$(0))
stpapi.put.field("tisfc0204m000","prdt.t.segment.2",str$(utc.num()))
stpapi.put.field("tisfc0204m000","pldt.f.segment.1",str$(0))
stpapi.put.field("tisfc0204m000","pldt.t.segment.2",str$(utc.num()))
stpapi.put.field("tisfc0204m000","check.shortages",str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0204m000","interactive",str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0204m000","shortage.report",str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0204m000","print.process",str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0204m000","print.error",str$(etol(tcyesno.yes)))
stpapi.set.report("tisfc0204m000","rtisfc020402000","D",error.msg)
stpapi.form.command("tisfc0204m000", 5, "exec.cont.process",error.msg)

I might even make the error report no - and then just check to make sure the order released.