Baanboard.com

Baanboard.com (http://www.baanboard.com/baanboard/index.php)
-   AFS/DDC/OLE: Function servers (http://www.baanboard.com/baanboard/forumdisplay.php?f=59)
-   -   Copy (option dupl.occur) with AFS ?? (http://www.baanboard.com/baanboard/showthread.php?t=8399)

Guillaume.G 13th January 2003 15:59

Copy (option dupl.occur) with AFS ??
 
Hi,

I want to simulate the dupl.occur action with the AFS.
But after several try, it's not work !!!!!

In my case i want to copy à record of tipcs2121m000

So what is the solution to user dupl.occur with AFS ???


Thank you for your help


Guillaume.G

mark_h 13th January 2003 17:56

Not sure it is possible.
 
I think this is one of the features that is not possible using AFS. Like in this post what I recommend trying is to do a find of the record you want to copy, then put the new key fields(or item), then try a insert. This may work. If you do try it I would be interested in knowing if it did work.

Good Luck!

Mark

Guillaume.G 13th January 2003 18:16

Dupl.occur is possible but ....
 
Hi mark_h,

I try your solution, but it's not work
because the field of the screen is not in the API field buffer so the fields are empty (==> Error message )
Your idea is correct if you make a stpapi.get.field for all field of all form of the session
and for the copy you make a put field of all field (with modify value) and finish with an insert.
But the very big problem is the code of the choice.dupl.occur of the session is NOT executed !!!!

So i find an another solution which it's possible only if you have the program script std. and with stpapi.application.option.

the solution is :
you create a user.9 option in the std script (tipcs2121)
choice.user.9
on.choice
if api.mode then
execute(dupl.occur)
endif

And in the specific program
stpapi.put.field(ARTPCS,"tipcs021.cprj",itm.cprj)
stpapi.put.field(ARTPCS,"tipcs021.item",itm.item)
stpapi.put.field(ARTPCS,"tipcs021.dsca",itm.dsca)
stpapi.application.option(ARTPCS, 1, 9, error)
if error <> "" then
retsave = stpapi.save(ARTPCS,error)
if retsave = 0 then
stpapi.recover(ARTPCS,err.recover)
message.erreur = "Pb sauvegarde Article :"
& strip$(error)
send.mess(message.erreur,"----")
retour = 7
endif
endif
stpapi.end.session(ARTPCS)


Best Regard

Guillaume.G

lbencic 13th January 2003 18:25

Guillaume -
Good Idea :)
Also, you can add a section like that to the standard code without modifying the source code at all using the wrapper tools out there - QKEY, RMCgen and the freeware version on these boards: 'rush'.

Good thinking outside of the box - so much of the AFS programming needs that.

mark_h 13th January 2003 19:05

Excellent Solution
 
Great solution Guillaume.G and thanks to Lisa for pointing out how the extended source solutions could work with this. I have to keep this in mind . :)

Mark

goooch 21st January 2005 10:36

Hi
And what about stpapi.application.option( "...", 1, -32 (or any form option relative to user.0), error ) ?
(looks like it works, tdsls4102s000 raises copy session tdsls4201s000, for example, but I did not play with it enough time, sorry)

mark_h 21st January 2005 15:49

Interesting concept. The instructions mention executing only user.0 thru user.9. I just tested stpapi.application.option("tibom8411m000",1,-25,msg) to see if it would print a report(of course the print option was set on this session) - it did work.

If you did use it just be prepared that this functionality might not work or exist in the future. Of course it is not like future releases will never break API function server. I have not seen any new documentation on API commands, so good find Goooch. Others may want to test this and report back.

Mark

mefreakboy 13th June 2006 23:00

If anybody is interested, I have tried the above suggestion and it does work for copying records. I am using a "template" supplier to copy to a new temporary supplier that is being handled by file transfers, replacing only the supplier code and name fields. Here's a sampling of the code for B4c4:

tccomf2101m000.put.Supplier(titce900.suno)
if tccomf2101m000.find() <> 1 then
|error - can't find supplier template
else
tccomf2101m000.put.Supplier(temp.suno)
tccomf2101m000.put.Name.tccom020.nama(temp.nama)
stpapi.application.option( "tccom2101m000", 1, -32, err.mess)
tccomf2101m000.save(err.mess)
tccomf2101m000.end()
endif

Thanks to all those who hinted at a solution here. There are way too many fields in the supplier table to make this a palatable experience.

Carey

baangeek77 11th June 2007 16:36

beautiful!
 
i realize this is a year old (almost exactly a year old i just noticed :)) but this is exactly what i was looking for , thx so much mefreakboy! just curious, where can I find a list of codes to use for stapi.application.option. in other words how do you know -42 is for copy and -25 is for print? if any one knows i'd appreciate it. Thx!

-bg77

mark_h 12th June 2007 15:30

You get the numbers from the maintain form, then standard options. This gives you a list with the number associated with that option.

garias 11th March 2017 17:34

Any option for Infor LN
 
Since stpapi.application.option does not work for Infor LN
which option we could use to enable the dupl.occur command in a session called by AFS

Regards

Gerard


All times are GMT +2. The time now is 08:26.


vB.Sponsors
©2001-2017 - Baanboard.com - Baanforums.com