rmoreira0271
31st May 2006, 21:12
Hi friends,

I am with a problem to execute AFS in the LN. :confused:
I create a program that imports an archive text to make a load of countable balances. For this, the session is necessary to execute way AFS the session tfgld1101m000 (Transactions) to register in cadastre transactions based in the loaded load. The AFS in this session is correct, but when I go to subsession tfgld1105s000(Transaction's Entry ) I didn't obtain to insert the due fields.

In stpapi.insert this return "Command Disabled"

Detail: all fields that I insert are from form 2.

I believe that it is trying to insert a register in form1, this that is not possible, only new group.

It follows part of the code below:

|after "insert" and "save" in tfgld1101m000...

stpapi.mark("tfgld1101m000")

stpapi.handle.subproc("tfgld1101m000", "tfgld1105s000", "add")
stpapi.form.command("tfgld1101m000", 5, "exec.cont.process", error.msg)

stpapi.put.field("tfgld1105s000", "tfgld102.hcod.l", shiftl$(hist1))
stpapi.put.field("tfgld1105s000", "tfgld102.bpid", shiftl$(parc1))
stpapi.put.field("tfgld1105s000", "tfgld102.leac", shiftl$(conta1))
stpapi.put.field("tfgld1105s000", "form.amnt", str$(valor1))
stpapi.put.field("tfgld1105s000", "tfgld102.refr", ref_tran)

ret = stpapi.change.view("tfgld1105s000", error.msg) |não retorna erro


|Import variable "form.curr" from subsession tfgld1105s000 - always value = 1 (form 1) :(

stpapi.get.field("tfgld1105s000","form.curr", fnr)

stpapi.insert("tfgld1105s000", 0, error.msg) |return "Command Disabled" :mad:
stpapi.save("tfgld1105s000", error.msg)

If somebody helps me, I'm so thankful

[]s

Bruno Teixeira Lomba

mark_h
1st June 2006, 05:51
You can search on command disabled in this forum - I did not find anything related to your session, but it seems typically this needs some update objects. So you might want to check with support.

veyant
6th June 2006, 13:25
Hi ,

Command Disabled generally comes when u try to execute a command which is not active in session. so might be the insert option is not available in tfgld1105s000 subsession.

Just repeat the process manually in session.Open tfgld1101m000, put values and press continue button to activate "tfgld1105s000". Now check is Insrt option is disabled or not. if it is disabled then it is the problem else it might be something else.

Check and revert back

lomba86
6th June 2006, 20:08
Manually, I only obtain to insert in form 2, but in form 1, only insert a new group, not register. It tries to always insert in form 1 (look at the variable that I imported)

Thanks

som.papai
3rd January 2008, 13:17
Hi all,
In ERP_LN 6.1 fp2.
I am also facing the same problem.
I want to go form 2 , but i am in form 1 in session tfgld1103s000.
Any AFS Command is available to change current form ..??
In Form 1 Insert Button is disable but if i go to Form 2 Insert become button Enable .

I know that in LN only one form for each session, what we see in BaaN System
There r multiple Tab means multiple form, but in LN multiple Tab means multiple
Group.

So, How can i go to Group 2 ..through AFS??
The Table tfgld102 have no DAL , so can't write dal function to insert value in table tfgld102.

That's why when i used stpapi.insert error come "Command Disable" .
and "stpapi.form.command("tfgld1103s000", 5, "exec.add.set",error)" is
the correct way to call New Button Click Event..??

Plz help me.
It's Go Live Critical Issue.
:mad:

mark_h
3rd January 2008, 16:03
I do not know anything about ln
(1) Can you activate the command on form 1?
(2) Can you switch which form is active when the session starts? Maybe make form 2 active from the start.
(3) Again I do not know about LN but on form 2 could you create a user option(like choice.user.1) that does the same thing as the form command. Then you might be able to use the stpapi.application.option command.

som.papai
3rd January 2008, 17:06
Hi All,
Is this "stpapi.form.command("tfgld1103s000", 5, "exec.add.set",error)" is
the correct way to call New Button Click Event..??

:mad:

som.papai
5th January 2008, 09:20
Hi All,
How can i go to Group 2 in session tfgld1103s000 through AFS..??, because
When Session is open the New Button is Disable,but when i go to Group 2 the New Button is enable.


Any one are there... for this Issue??

Please help me.

mark_h
7th January 2008, 18:47
Can you try some of my suggestions above? I am not sure they are possible, but thought I would suggest them anyway. The format of the command you are using looks correct, but I can not be sure since I am not on LN. You may have to wait until a LN user comes along and even then they might not have an answer.

Good Luck!

Jabitxo
8th January 2008, 13:16
Hi,

Your code is correct, the problem is that the choice add.set is only enabled in group 4, and (I think) there is no way to change to another group via API.

I've solved it modifying the program script tfgld1103, adding the 'if not api.mode' condition:

|** In section before.group of group.3

if not api.mode then
disable.commands(add.set, dupl.occur)
endif

Gylen9
19th May 2010, 09:29
Baan 5b SP19
Session: tfgld1103s000

* Command disabled; no insert is possible in the current state of the session.

I'm recieving the same error message.
I believe it is due to the source code as proposed by Jabitxo in http://www.baanboard.com/baanboard/showthread.php?p=132621#post132621

Does anyone have a solution other than changing the source code?

Jabitxo

Hi,

Your code is correct, the problem is that the choice add.set is only enabled in group 4, and (I think) there is no way to change to another group via API.

I've solved it modifying the program script tfgld1103, adding the 'if not api.mode' condition:

|** In section before.group of group.3

if not api.mode then
disable.commands(add.set, dupl.occur)
endif