SDerrick
24th January 2005, 15:33
Hello, I am trying to write session which blanks the value of the "Quantity to deliver" field in "Report Operations Complete" tisfc0202m000 in B4c4.

My problem is regarding the resulting report. Manually, if you change the quantity to 0 and hit the save button a "Select Device" screen appears. I am trying to change this device to ASCIF and then close the session but when I go back to the session it nothing has been changed. I don't get any errors when I debug it and can't find out what I am doing wrong. My source is below, can anyone help please?

stpapi.get.field("tisfc0102m000", "tisfc010.pdno", field)
stpapi.put.field("tisfc0102m000", "tisfc010.pdno", str$(tisfc001.pdno))
stpapi.get.field("tisfc0102m000", "tisfc010.opno", field)
stpapi.put.field("tisfc0102m000", "tisfc010.opno", "0")
stpapi.find("tisfc0102m000")

stpapi.get.field("tisfc0102m000", "tisfc010.pdno", field)
stpapi.browse.set("tisfc0102m000","last.set", error.str)
stpapi.get.field("tisfc0102m000", "tisfc010.tano", field)
stpapi.get.field("tisfc0102m000", "tisfc010.qcmp", field)
new.val = new.val + val(field)
stpapi.put.field("tisfc0102m000", "tisfc010.qcmp", str$(new.val))
stpapi.get.field("tisfc0102m000", "tisfc010.qcmp", field)
stpapi.save("tisfc0102m000", error.str)
stpapi.set.report("tisfc0102m000", "rtdilc420102000", "ASCIT", error.str)

stpapi.end.session("tisfc0102m000")

Many Thanks

Simon Derrick

mark_h
24th January 2005, 15:56
If the save initiates the report then try switching these two lines:


stpapi.save("tisfc0102m000", error.str)
stpapi.set.report("tisfc0102m000", "rtdilc420102000", "ASCIT", error.str)


You need to define the report before actually having the device screen appear.

Mark

SDerrick
24th January 2005, 16:29
Thanks for your advice, I will leave the two lines switched but it didn't amend the quantity. I was wondering if I have to do anything to hit continue on the "Select Device" screen?

SDerrick
24th January 2005, 16:31
Just a note to correct an error in my original message. I don't want the quantity set to zero, just reduced. It's not really relevant to the problem.

lbencic
24th January 2005, 16:46
Do you get the report though? Not sure if this is relevant, it looks like the record is not saving, but for the report, if you are using ASCIF or any ASCII file, I always set the spool.fileout name, I am not sure if the default works. Try this, right after the set report:


stpapi.put.field("tisfc0102m000", "spool.fileout", "filename")

SDerrick
24th January 2005, 17:04
Thanks again, but still no luck. It debugs fine with no error messages but just does nothing in the session. It populates the fields and selects the correct record fine. It just seems to abort all changes before saving.

mark_h
24th January 2005, 17:06
Hmm - never tried what Lisa suggested, usually I just set spool.fileout = somefile. Something else I thought of was that maybe you could try stpapi.update instead of save. And no typically you do not have to do anything for the device. I usually set the device, set the output file name, set the report - and then just issue the continue or update commands.

Mark

SDerrick
24th January 2005, 17:15
That has worked a treat. Thanks enormously.

Simon