justknowledge
16th July 2007, 15:10
Hi ,

I am writing AFS for print sales invoice however i am facing problem to print sales invoice report and change the status as well as generating invoice number in table tdsls045.

I am not able to trace out where the actual problem is in my code.

Can sombody please help me.

Regards
Nitesh


domain tcncmp cmpnr
cmpnr = get.compnr()

rprt_log = creat.tmp.file$(bse.tmp.dir$())
stpapi.put.field( "tdsls4404m000", "Printed", str$(etol(tcyesno.no)))
stpapi.put.field( "tdsls4404m000", "inv.date", str$(date.num()))
stpapi.put.field( "tdsls4404m000", "selection", str$(etol(tcyesno.no)))
stpapi.put.field( "tdsls4404m000", "comp.f", str$(cmpnr))
stpapi.put.field( "tdsls4404m000", "comp.t", str$(cmpnr))
stpapi.put.field( "tdsls4404m000", "cuno.f", "")
stpapi.put.field( "tdsls4404m000", "cuno.t", "ZZZZZZ")
stpapi.put.field( "tdsls4404m000", "orno.f", str$(orno1))
stpapi.put.field( "tdsls4404m000", "orno.t", str$(orno1))
stpapi.put.field( "tdsls4404m000", "copt.f", "")
stpapi.put.field( "tdsls4404m000", "copt.t", "ZZZ")
stpapi.put.field( "tdsls4404m000", "amount.f", str$(-9999999999.00))
stpapi.put.field( "tdsls4404m000", "amount.t", str$(9999999999.00))
stpapi.put.field( "tdsls4404m000", "definite", str$(etol(tcyesno.yes)))
stpapi.put.field( "tdsls4404m000", "direct.process", str$(etol(tcyesno.no)))
stpapi.put.field( "tdsls4404m000", "exci.inv", str$(etol(tcyesno.no)))
stpapi.put.field( "tdsls4404m000", "totals", str$(etol(tcyesno.no)))

|if prnt.options tcyesno.yes then make prnt.sellpr = tcyesno.no
|if prnt.options tcyesno.no then make prnt.sellpr = tcyesno.yes
|because only one rpt can be set be set thru AFS.

|so selection as to be make
stpapi.put.field( "tdsls4404m000", "prnt.options", str$(etol(tcyesno.yes)))
stpapi.put.field( "tdsls4404m000", "prnt.sellpr", str$(etol(tcyesno.yes)))
stpapi.put.field( "tdsls4404m000", "reportgrp","1")
stpapi.put.field( "tdsls4404m000", "spool.fileout",rprt_log)
stpapi.set.report("tdsls4404m000", "rtdsls440401000","D",error.mess)
if isspace(error.mess) then
stpapi.print.report("tdsls4404m000", error.mess)
stpapi.continue.process("tdsls4404m000",error.mess)
else
stpapi.recover("tdsls4404m000", error.mess)
endif

stpapi.end.session("tdsls4404m000")

mark_h
16th July 2007, 15:36
Search for tdsls4404m000 and you will find some other posts to look at - like this thread (http://www.baanboard.com/baanboard/showthread.php?t=27460&highlight=tdsls4404m000). I believe one post mentions a patch needed.

I do not think these two lines are needed:

stpapi.put.field( "tdsls4404m000", "reportgrp","1")
stpapi.put.field( "tdsls4404m000", "spool.fileout",rprt_log)

Then again we do not use the session, but from the one example I looked at they did not set these fields.

Good Luck!

justknowledge
17th July 2007, 13:30
Hi Mark,

I think there is a bug in tdsls4404m000 AFS when you run session with specific order basis. when i run afs with specific orders and put final invoice to tcyesno.yes or tcyesno.no same proforma prints.

Where as per logic if i put tcyesno.yes in final invoice field it should print sales invoice and if i put tcyesno.no in final invoice it should print performa

However if i choose only order range and not specific order AFS works perfactly (Print sales invoice,Update sales order status,generate invoice no)

I went through all the thread available and applied every possible option but couldn't successed.

please provide suggestion for same.

Regards
Nitesh

mark_h
17th July 2007, 15:53
Yes - sounds like a bug. You can always contact support and see if they have a solution.

This may not work for you, but what I did for print specific purchase orders, was to ask the user to enter up to 10 orders. Then in the background I ran the session 10 times for each of the orders using the print by order range. So I just ran the session for each individual order 1 at a time. The difference was that my users were always printing - I know at one point I did not let them pick a display device. Just a thought.

justknowledge
18th July 2007, 06:19
your idea is good however i will have to speak to my functional consultant regarding this option.

Thanks for your suggestions

Regards
Nitesh