mitchell
6th May 2011, 16:32
I have created a session which will first run tdsls4402m000 – Print Picking Lists and then it will run a new custom report. I need the picking list number generated from the session tdsls4402m000 returned so that I can use it in my customized report.

What I have so far …

In my custom session, I call the standard Baan session tdsls4402m000 and run a report.

stpapi.set.report("tdsls4402m000","rtdsls44020100c",spool.device,error.msg)
stpapi.continue.process("tdsls4402m000",error.msg)

import("parent",proc_num)
get.var(proc_num,"free$",ret.pino)

message("returned pino %s",ret.pino)

if not isspace(error.msg) then
message("Error when setting report: %s", error.msg)
endif

stpapi.end.session("tdsls4402m000")


Within the report script for rtdsls44020100c I added the following:

after.program:
ret.pino = tdsls045.pino
export("free$",ret.pino)


ret.pino is extern in both the custom session and the report script.

ret.pino seems to be zero all of the time, even though a picking list is generated.

Thanks
Barb

mitchell
6th May 2011, 17:43
I used the stpapi.get.field in my customized session and that worked for me.

mark_h
9th May 2011, 15:31
Can you use the stpapi.get before stpapi.end.session as mitchell recommended?

The problem I see is:

stpapi.set.report("tdsls4402m000","rtdsls44020100c",spool.device,error.msg)
stpapi.continue.process("tdsls4402m000",error.msg)

Once you hit the continue - it goes off and runs the report and closes the report. So the ret.pino will always be 0.

Hitesh Shah
11th May 2011, 19:07
Export in report script will put value in tdsls4402m000 and import in custom script will NOT get value from tdsls4402m000 as it is child and not parent .

Instead do following report script . Import parent . This will give the parent of parent ie ur customscript pid and then use that pid to retrieve / manipulate value in custom script from code in report script .

mitchell
11th May 2011, 21:11
This is working correctly using the stpapi.get.field.

I coded it as follows:

stpapi.set.report("tdsls4402m000","rtdsls44020100c",spool.device,error.msg)
stpapi.continue.process("tdsls4402m000",error.msg)

if not isspace(error.msg) then
message("Error when setting report: %s", error.msg)
else
stpapi.get.field("tdsls4402m000","tdsls045.pino",ret.value)
ret.pino = val(ret.value)
endif

stpapi.end.session("tdsls4402m000")

Thanks.