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)
-   -   Duplicate record using AFS (http://www.baanboard.com/baanboard/showthread.php?t=69180)

vik.patil 15th August 2016 21:44

Duplicate record using AFS
 
Hi,

Can we duplicate record from multi occurrence session using AFS? I am unable to find option for Duplicate command using AFS.

Any help will be appreciated.

Regards,

Vikram

bhushanchanda 16th August 2016 08:16

Hi,

What is the session? What have you tried? Did you tried using DAL instead of AFS?

mark_h 16th August 2016 14:14

Pretty much if you can do it manually you can do it via AFS. Not always the case -think in one place all I did was store off the form fields and then just add another line in the multi-occurrence session. Like bhushan says which session and what exactly have your tried. I also moved this to the AFS forum - you can search this forum for the session in question and sometimes find working code or see what others have tried.

vik.patil 16th August 2016 18:09

Thanks Bhushan and Mark,
Basically, We have one customized session which has Product Variant field and we need to copy same to another Variant so we are trying to use tipcf5501m000 session to select variant and click Duplicate command to create copy of selected variant. I am unable get command to duplicate record. Hope now requirement is clear.

mark_h 16th August 2016 19:25

If it is a button on the forum you have to figure out what button it is. In 4c4 sometimes they use the user defined fields I have to use stpapi.application.option. Not sure if that is the case in LN as your profile shows. I know for LN you might use stpapi.form.command - but you have to figure out the parameters for the command - I only have access to 4c4.

vik.patil 17th August 2016 02:43

I am working on Baan V and stpapi.form.command is applicable. Basically we don't want to give direct access to Product variant Session to users so we are creating wrapper session to duplicate existing Variant. I tried with this function stpapi.form.command but in vain. Is there any way to call choice commands from AFS?

manish_patel 17th August 2016 11:00

I think, there is no specific AFS function to execute standard option duplicate/copy.

You have to get the required fields value using Baan SQL query and then
Set the field value - stpapi.put.field() |**put field value from query result except key field
Insert the record - stpapi.insert().

mark_h 17th August 2016 14:48

Actually in 4c4 even if you do not have direct access to the session you still have to have permissions to it. We use dem flows to take care of that part and we also wrote our own run program. Our run program makes sure the session is on the dem flow - those are the only ones that can be run using it.

Do you have source code for the session? I am wondering if there is like a function or something you can execute with the form command?

Another option is - since you don't want them to have direct access. Is to give them a display screen (you probably already did this) with a button to copy. When they hit the copy button you can go read from the baan tables the data you need. Then like Manish says you could just do a bunch of put fields and an insert of a new record.

garias 11th March 2017 17:39

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

mark_h 12th March 2017 01:33

Look at the stpapi.form.command that is used in LN.

garias 12th March 2017 10:42

Hello Mark
I have tried to use stpapi.form.command to execute the dupl.occur command in a session called by AFS, but it does not work:
stpapi.form.command (mysession, 5, "exec.dupl.occur", error.msg)
I have tried:
stpapi.form.command (mysession, 5, "dupl.occur", error.msg)

Any idea.
Gerard

manish@erpln 15th March 2017 10:58

Try this :-

stpapi.form.command (mysession, 2, "dupl.occur", error.msg)
or
stpapi.form.command (mysession, 2, "exec.dupl.occur", error.msg)

If doesn't works then you can use DAL function dal.copy.object("tableid").


All times are GMT +2. The time now is 10:02.


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