baan.kmurali
22nd August 2014, 16:20
Dear Experts,
We are automated the sales invoice process by AFS. If we select the "Enter specific order" as "NO", the sales invoice is generated finely. or else if we select the "Enter specific order" as "YES", it's not working and not showing any error.

Please find the below coding and help me to close it....

Thanks in advance...

orno1 = 2908655
inv.date1 = date.num()
stpapi.put.field("tdsls4404m000", "printed", str$(etol(tcyesno.no)))
stpapi.put.field("tdsls4404m000", "inv.date", str$(inv.date1))
stpapi.put.field("tdsls4404m000", "selection", str$(etol(tcyesno.yes)))
stpapi.put.field("tdsls4404m000", "comp.f", "000")
stpapi.put.field("tdsls4404m000", "comp.t", "999")
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", "cotp.f", "")
stpapi.put.field("tdsls4404m000", "cotp.t", "ZZZ")
stpapi.put.field("tdsls4404m000", "amount.f", "0")
stpapi.put.field("tdsls4404m000", "amount.t", "99999999999.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)))
stpapi.put.field("tdsls4404m000", "prnt.options", str$(etol(tcyesno.no)))
stpapi.put.field("tdsls4404m000", "prnt.sellpr", str$(etol(tcyesno.no)))
stpapi.set.report("tdsls4404m000", "rtdsls440401000", "D" , error.mess)
if not isspace(error.mess) then
message(error.mess)
endif
stpapi.handle.subproc("tdsls4404m000","tdsls4820s000", "add")
stpapi.continue.process("tdsls4404m000", error.mess)
if not isspace(error.mess) then
message(error.mess)
endif
stpapi.handle.subproc("tdsls4404m000","tdsls4820s000", "add")
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno1),1)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno2),2)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno3),3)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno4),4)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno5),5)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno6),6)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno7),7)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno8),8)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno9),9)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno10),10)
stpapi.continue.process("tdsls4820s000", error.mess)
stpapi.end.session( "tdsls4820s000", error.mess )
stpapi.end.session("tdsls4404m000")

Thanks and Regards,
Murali

bhushanchanda
22nd August 2014, 16:36
Hi,

Declare one variable like orno.temp like





Now pass this orno.temp without str$() to your code.

Also, check if the domain for inv.date1 is correct. I dont have any idea about this session.

So it will be like:-

extern domain tcorno orno.temp
orno1 = 2908655
orno.temp = str$(orno1)
inv.date1 = date.num()
stpapi.put.field("tdsls4404m000", "printed", str$(etol(tcyesno.no)))
stpapi.put.field("tdsls4404m000", "inv.date", str$(inv.date1))
stpapi.put.field("tdsls4404m000", "selection", str$(etol(tcyesno.yes)))
stpapi.put.field("tdsls4404m000", "comp.f", "000")
stpapi.put.field("tdsls4404m000", "comp.t", "999")
stpapi.put.field("tdsls4404m000", "cuno.f", "")
stpapi.put.field("tdsls4404m000", "cuno.t", "ZZZZZZ")
stpapi.put.field("tdsls4404m000", "orno.f", orno.temp)
stpapi.put.field("tdsls4404m000", "orno.t", orno.temp)
stpapi.put.field("tdsls4404m000", "cotp.f", "")
stpapi.put.field("tdsls4404m000", "cotp.t", "ZZZ")
stpapi.put.field("tdsls4404m000", "amount.f", "0")
stpapi.put.field("tdsls4404m000", "amount.t", "99999999999.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)))
stpapi.put.field("tdsls4404m000", "prnt.options", str$(etol(tcyesno.no)))
stpapi.put.field("tdsls4404m000", "prnt.sellpr", str$(etol(tcyesno.no)))
stpapi.set.report("tdsls4404m000", "rtdsls440401000", "D" , error.mess)
if not isspace(error.mess) then
message(error.mess)
endif
stpapi.handle.subproc("tdsls4404m000","tdsls4820s000", "add")
stpapi.continue.process("tdsls4404m000", error.mess)
if not isspace(error.mess) then
message(error.mess)
endif

|*** DO THE SIMILAR CHANGES IN THE FOLLOWING CODE AS WELL
stpapi.handle.subproc("tdsls4404m000","tdsls4820s000", "add")
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno1),1)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno2),2)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno3),3)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno4),4)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno5),5)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno6),6)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno7),7)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno8),8)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno9),9)
stpapi.put.field( "tdsls4820s000", "orno.select", str$(orno10),10)
stpapi.continue.process("tdsls4820s000", error.mess)
stpapi.end.session( "tdsls4820s000", error.mess )
stpapi.end.session("tdsls4404m000")

mark_h
24th August 2014, 00:26
I tried a few times to get this working in print purchase orders. I don't think it matters but you could try not putting the orno.f and orno.t ranges at all. The problem the way I see it is the sub-session does not get activated until the continue and then it is too late cause the main session is already running. I played with it a little bit, but never really worried about it too much.

My solution was to just make the print process a function and pass all 10 of the orders to it one at a time. As a matter of fact one of the function servers I wrote asks for 10 orders - then just prints them 1 at a time. Save me some the trouble of trying to figure it out.

baan.kmurali
25th August 2014, 07:32
Thanks mark and bhushanchanda, I need to generate single invoice for a packing slip(for multiple orders).

If we select the "Enter specific order" as "NO", the sales invoice is generated finely. or else if we select the "Enter specific order" as "YES", it's not working and not showing any error.

Please advice us...

Regards,
Murali

mark_h
25th August 2014, 16:19
Like I said this is like print purchase orders. When you enter yes in print specific order it zooms automatically to the session that lets you enter the specific order, then in that session the continue returns you to the print session. Once there you can hit print. And it generates only those orders.

Now when you are writing a function server - when you do a put on the enter specific order of yes, it does not activate the subsession. It does not occur until you hit continue on the print session. By then I believe it is too late. The orders are not filled for it to print. I do not believe the orders get passed back to the print session. If you have source code you can probably trace through all of this. That might help you see if you can control it - or maybe you have to add code to get it to work in AFS.

You can try this but I am not sure it will work:

extern domain tcorno orno.select(10)

orno.select(1) = orno(1)
....
orno.select(10 = orno(10)
export(orno.select, "orno.select")
inv.date1 = date.num()
stpapi.put.field("tdsls4404m000", "printed", str$(etol(tcyesno.no)))
stpapi.put.field("tdsls4404m000", "inv.date", str$(inv.date1))
stpapi.put.field("tdsls4404m000", "selection", str$(etol(tcyesno.yes)))
stpapi.put.field("tdsls4404m000", "comp.f", "000")
stpapi.put.field("tdsls4404m000", "comp.t", "999")
stpapi.put.field("tdsls4404m000", "cuno.f", "")
stpapi.put.field("tdsls4404m000", "cuno.t", "ZZZZZZ")
stpapi.put.field("tdsls4404m000", "cotp.f", "")
stpapi.put.field("tdsls4404m000", "cotp.t", "ZZZ")
stpapi.put.field("tdsls4404m000", "amount.f", "0")
stpapi.put.field("tdsls4404m000", "amount.t", "99999999999.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)))
stpapi.put.field("tdsls4404m000", "prnt.options", str$(etol(tcyesno.no)))
stpapi.put.field("tdsls4404m000", "prnt.sellpr", str$(etol(tcyesno.no)))
stpapi.set.report("tdsls4404m000", "rtdsls440401000", "D" , error.mess)
if not isspace(error.mess) then
message(error.mess)
endif
stpapi.continue.process("tdsls4404m000", error.mess)

baan.kmurali
26th August 2014, 13:26
Mark.. I tried what you suggested. It's not working...

Please advice...

Thanks,
Murali

mark_h
26th August 2014, 14:48
About the only thing I can think of to try. Do you have source code you can trace thru?