Babu N
11th May 2022, 21:43
Hi Friends,

I am using stpapi commands to invoke reprint invoice from my customized session.

Below is the code:

stpapi.put.field("cisli2405m000","f.sls.inv.company", str$("082"))
stpapi.put.field("cisli2405m000","r.reprint.option", str$(etol(cisli.rprn.by.invoice)))
stpapi.put.field("cisli2405m000","prnt.lang", str$(etol(cisli.lang.txct)))

stpapi.put.field("cisli2405m000","f.fin.company.f", str$("082"))
stpapi.put.field("cisli2405m000","f.fin.company.t", str$("082"))
stpapi.put.field("cisli2405m000","f.trans.type.f", str$(tran.type))
stpapi.put.field("cisli2405m000","f.trans.type.t", str$(tran.type))
stpapi.put.field("cisli2405m000","f.document.f", str$(docn.number))
stpapi.put.field("cisli2405m000","f.document.t", str$(docn.number))
stpapi.set.report("cisli2405m000", "rcisli120011maz", "D66", error)
stpapi.form.command("cisli2405m000",5,"exec.cont.process",error)
stpapi.end.session("cisli2405m000",error)

The input value for "r.reprint.option" always sets to default value "cisli.rprn.by.billing.req (Select by Invoicing Batch)" even after I have changed the value to "cisli.rprn.by.invoice (select By Invoice)", because of this the report is generated for the option "Select By Invoicing Batch" and prints all the invoices, despite me feeding a specific transaction type/ Document No for "f.trans.type.f, f.trans.type.t" & "f.document.f, f.document.t"

If someone can show light on this and identify what is wrong with my code. It will be of great help.

Thanks
Babu N

mark_h
11th May 2022, 23:16
What version are you on? Do you have access to the code? I found this thread on this session http://www.baanboard.com/baanboard/showthread.php?t=15795&highlight=cisli2405m000. I think around post # 11 it mentions what happens. If that was the case I could add code with the source extender where it set those fields to a different value in the form.init section.

Not all baan sessions are AFS friendly. In some sessions I had to use a source extender to add code to get them to work.

Babu N
12th May 2022, 14:24
Hi Mark,

I am in LN 10.5. I am not aware of source extender. Can you show some light on that.

Also, is there a way to pass the command for doing "save defaults" from stpapi?

Thanks
Babu N

mark_h
12th May 2022, 15:07
Here is http://www.baanboard.com/baanboard/showthread.php?t=559 posted by ~Vamsi a long time ago. We used QKEY on 4c4 and I believe RMC still has a similar product. As for save defaults not sure how to do that in stpapi - maybe with LN and the stpapi.forms.command (but not sure).

If you own source code then that would make it easier. You can put both the sessions in debug mode and step thru them to see what happens when you hit your continue.

Babu N
12th May 2022, 16:33
Hi Mark,

The issue is resolved now.
I moved the stpapi.put.field("cisli2405m000","f.reprint.option", str$(etol(cisli.rprn.by.invoice)))

just before the set report command..

and it worked.

Thanks for your support.

Babu N

mark_h
16th May 2022, 01:30
Nice solution - I would not have thought of that. It seems to me I put a few fields twice to get a function server to work - wonder if I could have just change the order also. Will never know since we no longer really use the system.