-   AFS/DDC/OLE: Function servers (
-   -   Unable to output a file with Device (re-write file) (

VishalMistry 20th June 2017 14:29

Unable to output a file with Device (re-write file)
1 Attachment(s)
Hello All,

This is for Baan IV

I want to call Print Purchase Order session (tdpur4401m000) for a range of supplier. I am selecting a Device with Re-write file type . I am specifically setting spool.fileout variable but the system is not generating the file at given path with given name. It is not generating any file.

The status of purchase order properly set to tdpur045.spur = 3

Can anybody guide what could be wrong in the given code ?


mark_h 21st June 2017 13:15

From the looks of the code the supplier from and to are the same so only one PO would go out to the file. Second before I do a I typically set spool.device to something specific and then spool.fileout to a file name. Quick example is something like this:

                spool.device = "ASCIF"
                spool.fileout = creat.tmp.file$(bse.tmp.dir$())

mark_h 21st June 2017 13:18

I forgot to mention - that there have been times where I want to run the same session in 4c4 repeatedly and put the output to a new file. When I do that the spool.fileout does not always change - so for example if I ran the above code in a look even creating a new temp file the output would always end up in the first file I created. To get past his what I ended up doing in a couple of cases was importing spool.device (using code extender qkey) and spool.fileout into the called session - that solved my problems.

VishalMistry 21st June 2017 15:56

Hello Mark,

Thanks for your guidance. I was able to generate file after using spool.close() before stpapi.end.session(). Once, the file is generated in temp folder, i just rename it using, CURRDATE_BATCH_SUNO). The problem is that it does not generate file for another supplier (obviously as spooler is closed before calling stpapi.end.session).


VishalMistry 22nd June 2017 09:44

Success in generating supplier-wise report
1 Attachment(s)
Hi Mark,

I was able to successfully generate a separate file for every vendor.

The mistake I was making is I had kept the stpapi.end.session() inside the loop. I kept the spool.close() inside the loop and moved out stpapi.end.session() and it worked.

I have attached sample script if anybody encounters the similar issue.


All times are GMT +2. The time now is 14:28.

©2001-2018 - -