litrax
15th October 2009, 09:53
I have a problem with disable.commands().
In a program script i use the following code (excerpt):

field.cprj:
before.display:
enable.modify()
if not check_input.vamb() then
disable.modify()
endif

functions:
function enable.modify()
{
enable.fields( "formfield1")
enable.fields( "formfield2")
enable.fields( "formfield3")
enable.commands( "somefunction1",
"somefunction2",
ADD.SET,
UPDATE.DB,
DUPL.OCCUR,
RECOVER.SET,
MARK.DELETE,
MODIFY.SET,
GLOBAL.DELETE,
GLOBAL.COPY
)
}

function disable.modify()
{
disable.fields( "formfield1")
disable.fields( "formfield2")
disable.fields( "formfield3")
disable.commands( "somefunction1",
"somefunction2",
ADD.SET,
UPDATE.DB,
DUPL.OCCUR,
RECOVER.SET,
MARK.DELETE,
MODIFY.SET,
GLOBAL.DELETE,
GLOBAL.COPY
)
}


Some explanation:
cprj is the first view field
in some cases ( if not check_input.vamb() ) I want to make it a "display session" for that record/set.

Now the error:
All commands in the given list are disabled correctly EXCEPT mark.delete and dupl.occur!?

What is wrong? :o Is it a spelling error?
Where can I look up what ID is mapped to MARK.DELETE, ADD.SET and so on?
I looked in the session ttadv4571m000 and copied the commands from there.

Has anyone an explanation for that "misbehavior" of ERPLN? :confused:
Can anyone help me to disallow all modifying (disable commands mentioned above) in a session, in case of a certain circumstance.

So many questions. I hope some of them can be answered.

george7a
15th October 2009, 12:03
Hi,

It is written in the manual that:You cannot use enable.commands() to enable commands that have been disabled either in the form definition or because the user is not authorized for the commands. Maybe those two were disabled from the form.

I hope it helps,

- George

litrax
15th October 2009, 12:51
Hi George,

what I'd prefer is disabling the commands.
In the form definition (Session --> Standard commands) I have enabled all commands except a few (create job, save.defaults).
And if some condition is met, I wanted to disable all that commands.

But I knew that it has something to do with mark.occur.
So I searched in the forum and found this thread which helped me to workaround my problem:
http://www.baanboard.com/baanboard/showthread.php?t=6096
I just simply took Mark's code and modified it:
choice.mark.occur:
after.choice:
if not check_input.vamb() then
remove.mark()
set.input.error("")
endif

Thanks for your help anyway...