mquinio
21st January 2005, 11:38
Hello,
i have a problem whith a specific script that i've create :
the main table of my session is tdsls041, and the user select a range of citg and the process read the tdsls041 (with a query extension to select only records wanted), then in the main.io section, i select only one record by orno using skip.io for the others.
in the next step the user can change a value of a validation field whith yes or no. My problem is now : when the user change this value and next use a button (for global validation or for another selection), i 've an error 206 on table tdlsl041.
I've skipped this error using skip.io in before.rewrite section, (i don't need at this step to let the process do an update), but after, i've a message wich appears : "Record not modified" and i've to press the OK button.
How can I avoid this message, because the user has the possibility of
modifying several lines and several pages, so the message will appear a lot.
If somebody can help me !!

Join a bitmap of the session and the source.

|*******************************************************************************
|* sls4000 Gestion planif Commandes
|* Michel QUINIO
|* 21/11/04
|*
|*******************************************************************************
declaration:


|****************************** tables ****************************************

table ttccom010 |* Customers
table ttipcs020 |* Projects
table ttdsls040 |* Sales Orders
table ttdsls041 |* Sales Order Lines
table ttdsls045 |* Sales Deliveries
table tsppcs005 |* complément info prj

|
|****************************** form variables ********************************

extern domain tcqsl1 qte.cde
extern domain tcyesno confirmed

|****************************** zoom variables ********************************

extern domain tcmcs.byte zoom.ckey
extern domain tcyesno choice.4220
extern domain tcmcs.long trac.code
extern domain tcparm citg4.f
extern domain tcparm citg4.t
extern domain tccitg citg.f
extern domain tccitg citg.t
extern domain tcmcs.str8 cosn
extern domain tccdis ctcd
extern domain tccdis crcd

extern domain tcsess calling.program

|****************************** prog variables ********************************

long counter
long idmax
long id1
long ret
extern long currkey
domain tcbool rechcours
domain tcbool inp.tbl
domain tcbool prjvalid
domain tcbool trecran
domain tcorno skip.orno
domain tcorno ornocours
domain tccitg skip.citg
domain tcorno check.orno
domain tccitg check.citg
domain tcorno tab_orno(999)
domain tcyesno tab_flag(999)
domain tcdate tab_date(999)
string tab_refa(20,999)
domain tcdate nvdate
domain tcdate olddate
string nvref(20)
string oldref(20)

domain tcbool old.occ |#89211-1.n

domain tcpsts old.psts | old project status
domain tcpsts new.psts | old project status

extern domain tctext error.message | error message

| |#72661-2.so
| domain tcqiv1 item.stoc |#17768-1.n
| |#72661-2.eo
extern domain tcstno stno.4120 |#10022675.n

|****************************** includes **************************************

| #include "itccom0007" |* Round quantity with given domain and

#include <bic_text> |* Triton Tools functions

|****************************** defines ***************************************
#define CTRL.Q 17
#define ESC 6 |#71261-1.sn
#define UP_ARROW 11
#define DOWN_ARROW 10 |#71261-1.en
#define LEFT_ARROW 8 |#84595-1.n

|****************************** program ***************************************
before.program:

calling.program = prog.name$
cosn = ""
ctcd = ""
crcd = ""

init_tbl()

| query.extension = "tdsls041.citg INRANGE :citg.f AND :citg.t and "&

query.extension = "(tdsls041._index7 inrange "&
"{:citg.f} and {:citg.t}) and "&
"tdsls041.cprj <> "" "" and "&
"tdsls041.cprj refers to tipcs020 and "&
"tipcs020.psts = tcpsts.simulation"

| SELECT tdsls041.citg, tdsls040.ddta,tdsls041.cprj,tdsls040.orno
| tdsls040.refb, tdsls040.crte, tdsls040.cfrw,sum(tdsls041.oqua) as qte_cde
| FROM tdsls041, tipcs020, tdsls040
| AND tdsls041.citg INRANGE :citg.f AND :citg.t
| AND tdsls041.cprj REFERS TO tipcs020
| AND tdsls041.orno REFERS TO tdsls040
| AND tipcs020.psts = tcpsts.simulation
| ORDER BY tdsls041.citg, tdsls041.ddta, tdsls041.cprj, tdsls041.orno
| GROUP BY tdsls041.citg, tdsls040.ddta,tdsls041.cprj,tdsls040.orno
| tdsls040.refb, tdsls040.crte, tdsls040.cfrw

|****************************** form ******************************************

form.1:
init.form:

citg4.f = " "
citg4.t = "ZZZZ"

|****************************** choice ****************************************

|choice.change.order:
|after.choice:
| currkey = curr.key |#10022675.n
| execute(def.find)

|choice.update.db:
|before.choice:
|choice.again()
|counter = 1
|remove.mark()
|on.choice:
|counter =1
|remove.mark()
|choice.first.set:
|after.choice:
| counter = 1

|choice.start.set:
|after.choice:
| counter = 1

|choice.find.data:
|after.choice:
| counter = 1

choice.last.set:
after.choice:
counter = 1

choice.modify.set:
before.choice:
counter = 1
|------ trecran sert à ne pas recalculer la qte cde si pas besoin ---

if not trecran then
trecran = true
endif

| for counter = 1 to filled.occ
| restore.rcd.main(counter)
| endfor

|choice.resize.frm:
|after.choice:
| counter = 1
|choice.mark.occur:
|before.choice:
|counter = 1
|on.choice:
|remove.mark()
|
| ***** Bouton Validation
|
| ***** Effectuer : passage du statut prj de simalation à actif (cf tipcs2102m000)
| ***** avancement du statut 1 au statut 2 (cf tdsls4401m000)
| ***** validation des dtes si modif (cf tdsls4101m000)
choice.user.1:

on.choice:

| db.retry.point()

| do.all.occ(validation.commande)

validation.commande()

init_tbl()
citg4.f = " "
display("citg4.f")
citg4.t = "ZZZZ"
display("citg4.t")
execute(start.set)

| else
| do.all.occ(deliver.one.line)

| endif

| ***** Bouton Nvelle Sélection
choice.user.2:

on.choice:
init_tbl()
citg4.f = " "
display("citg4.f")
citg4.t = "ZZZZ"
display("citg4.t")
execute(start.set)
| execute(find.data)

| ***** Bouton Quitter
choice.user.3:
on.choice:
execute(end.program)

|****************************** fields ****************************************

|field.all:
|before.zoom:
| clean.mess()
|after.zoom:
|--------------------
field.citg4.f:
|before.zoom:
| procesinfo$ = "to.key(3)"
before.display:
counter = 1
before.input:
if rechcours then
attr.input = false
else
attr.input = true
endif

after.input:
if citg4.f = " " then
citg4.t = "ZZZZ"
else
citg4.t = citg4.f
endif

citg.f = citg4.f & " "

|-------------------
field.citg4.t:

before.input:
if rechcours then
attr.input = false
else
attr.input = true
endif

after.input:
skip.orno = 0
skip.citg = " "
citg.t = citg4.t & "ZZ"
|when.field.changes:
|--------------------
field.tdsls040.ddat:
before.display:
if idmax > 0 then
check.orno = tdsls041.orno
rec_ddat(check.orno)
endif
before.input:

when.field.changes:
check.orno = tdsls041.orno
alim_tbl(check.orno)

|--------------------
field.tdsls040.refa:
before.display:
if idmax > 0 then
check.orno = tdsls041.orno
rec_refa(check.orno)
endif

before.input:
|--------------------

when.field.changes:
check.orno = tdsls041.orno
alim_tbl(check.orno)


|--------------------
field.qte.cde:
before.display:
if not trecran then
check.orno = tdsls041.orno
check.citg = tdsls041.citg
| rec_qte(check.orno,check.citg)
on.main.table(rec_qte,check.orno,check.citg)
endif

|--------------------
field.confirmed:
before.display:

confirmed = tcyesno.yes
if idmax > 0 then
check.orno = tdsls041.orno
rec_flag(check.orno)
endif

before.input:

when.field.changes:
check.orno = tdsls041.orno
alim_tbl(check.orno)
valid.pcs005(tdsls041.cprj)
|****************************** main table io *********************************
main.table.io: |EV#10022675

read.view:
counter = 1

before.read:
counter = 1
if not rechcours then
rechcours = true
endif

after.read:

if trecran then
trecran = false
endif

if (skip.orno <> tdsls041.orno or skip.citg <> tdsls041.citg) then
prjvalid = false
rec_pcs005(tdsls041.cprj)
if prjvalid then
skip.orno = tdsls041.orno
skip.citg = tdsls041.citg
check.orno = tdsls041.orno
inp.tbl = true
alim_tbl(check.orno)
else
skip.io("")
endif
else
skip.io("")
endif

before.rewrite:
counter = 1

skip.io(" ")
clean.mess()
after.rewrite:
counter = 1

|****************************** functions *************************************
functions:

function rec_pcs005(domain tccprj tdsls041.cprj)
{
select sppcs005.*
from sppcs005
where sppcs005._index1 = {:tdsls041.cprj}
selectdo
if sppcs005.epla = tcyesno.yes then
prjvalid = true
endif
endselect
}

function rec_qte(domain tcorno check.orno,domain tccitg check.citg)
{
qte.cde = 0
select sum(tdsls041.oqua):qte.cde
from tdsls041
where tdsls041._index1 = {:check.orno} and
tdsls041.citg = :check.citg
selectdo
endselect

}

function alim_tbl(domain tcorno check.orno)
{
domain tcbool trouve
trouve = false

|**** inp.tbl si true ==> on est en alimentation de tble et pas de modif si trouve.
|**** Si tbl déjà renseignée alors modif, sinon ajout.

if idmax <> 0 then
for id1 = 1 to idmax
if tab_orno(id1) = check.orno then
trouve = true
break
endif
endfor
endif

if not trouve then
idmax = idmax + 1
id1 = idmax
endif
|***** Si lecture table alors on prend sppcs005.cpla *****
if (inp.tbl and not trouve) then
confirmed = sppcs005.cpla
endif

if ((inp.tbl and not trouve) or (not inp.tbl and trouve)) then

if confirmed <> tcyesno.no and confirmed <> tcyesno.yes then
confirmed = tcyesno.yes
endif

tab_orno(id1) = check.orno
tab_flag(id1) = confirmed
tab_date(id1) = tdsls040.ddat
tab_refa(1,id1) = tdsls040.refa
endif

if inp.tbl then
inp.tbl = false
endif
}

function rec_flag(domain tcorno check.orno)
{

for id1 = 1 to idmax
if tab_orno(id1) = check.orno then
confirmed = tab_flag(id1)
break
endif
endfor

}

function rec_ddat(domain tcorno check.orno)
{
for id1 = 1 to idmax
if tab_orno(id1) = check.orno then
tdsls040.ddat = tab_date(id1)
break
endif
endfor

}

function rec_refa(domain tcorno check.orno)
{
for id1 = 1 to idmax
if tab_orno(id1) = check.orno then
tdsls040.refa = tab_refa(1,id1)
break
endif
endfor

}

function init_tbl()
{

idmax = 0
ret = set.mem(tab_orno,0)
ret = set.mem(tab_flag,tcyesno.yes)
ret = set.mem(tab_date,0)
ret = set.mem(tab_refa,"")
rechcours = false
trecran = false
confirmed = tcyesno.yes
|---------- A refaire lors de la fin de la validation -----

}


function validation.commande()
{
skip.orno = 0

db.retry.point()

select tdsls041.*,tipcs020.*,sppcs005.*
from tdsls041,tipcs020
where tdsls041._index7 inrange {:citg.f} and {:citg.t} and
tdsls041.cprj <> " " and
tdsls041.cprj = tipcs020.cprj and
tipcs020.psts = tcpsts.simulation and
tdsls041.cprj = sppcs005.cprj and
sppcs005.cpla = tcyesno.yes
selectdo
if skip.orno <> tdsls041.orno then
skip.orno = tdsls041.orno
valid.statut.cprj(tdsls041.cprj)
ornocours = tdsls041.orno
valid.date.orno(tdsls041.orno)
valid.accuse.rcp(tdsls041.orno)
commit.transaction()
endif
endselect
}

|function validation.commande()
|{
| confirmed = tcyesno.yes
| if idmax > 0 then
| check.orno = tdsls041.orno
| rec_flag(check.orno)
| endif
| if confirmed = tcyesno.yes then
| mess("tototototo",0)
| valid.statut.cprj(tdsls041.cprj)
| ornocours = tdsls041.orno
| valid.date.orno(tdsls041.orno)
| valid.accuse.rcp(tdsls041.orno)
| commit.transaction()
| else
| valid.pcs005(tdsls041.cprj)
| endif
|}



function valid.statut.cprj(domain tccprj tdsls041.cprj)
{
select tipcs020.*
from tipcs020 for update
where tipcs020._index1 = {:tdsls041.cprj} and
tipcs020.psts = tcpsts.simulation
selectdo
new.psts = tcpsts.active
old.psts = tcpsts.simulation
tipcs.dll2102.validate.new.project.status(
tipcs020.cprj,
old.psts,
new.psts,
error.message)
if not isspace(error.message) then
tipcs020.psts = old.psts
message(error.message)
input.again()

else
tipcs020.dtpl = date.num()
tipcs020.psts = tcpsts.active
tipcs.dll2102.process.project.status.change(tipcs020.cprj)
db.update(ttipcs020, db.retry)
endif

endselect
}

function valid.date.orno(domain tcorno ornocours)
{

| check.orno = tdsls041.orno
| rec_ddat(check.orno)
| nvdate = tdsls040.ddat
| olddate = tdsls040.ddat
|
| check.orno = tdsls041.orno
| rec_refa(check.orno)
| nvref = tdsls040.refa
|
select tdsls040.*
from tdsls040 for update
where tdsls040._index1 = {:ornocours}
| (tdsls040.ddat <> :nvdate or tdsls040.refa <> :nvref)
selectdo
olddate = tdsls040.ddat
oldref = tdsls040.refa

check.orno = tdsls041.orno
rec_ddat(check.orno)
nvdate = tdsls040.ddat
tdsls040.ddat = olddate

check.orno = tdsls041.orno
rec_refa(check.orno)
nvref = tdsls040.refa
tdsls040.refa = oldref

if tdsls040.ddat <> nvdate or tdsls040.refa <> nvref then
if tdsls040.ddat <> nvdate then
tdsls040.ddat = nvdate
tdsls040.prdt = nvdate
endif

tdsls040.refa = nvref

db.update(ttdsls040,db.retry)
commit.transaction()
endif

endselect

if olddate <> nvdate then
status.off()
zoom.to$("tdsls4809s000",z.session,"sls4101","",0)
status.on()
endif
}

function valid.accuse.rcp(domain tcorno tdsls041.orno)
{

select tdsls045.*
from tdsls045 for update
where tdsls045._index1 = {:tdsls041.orno}
selectdo
if tdsls045.pmsk(1;1) <> "n" then
if tdsls045.ssls = 1 then
tdsls045.pmsk(1;1) = "e"
tdsls045.ssls = 2
endif
db.update(ttdsls045,db.retry)
endif
endselect

}

function valid.pcs005(domain tccprj tdsls041.cprj)
{
select sppcs005.*
from sppcs005 for update
where sppcs005._index1 = {:tdsls041.cprj}
selectdo
sppcs005.cpla = confirmed
db.update(tsppcs005, db.retry)
commit.transaction()
endselect
}

malutz
21st January 2005, 13:22
the source would help to analyze your problem. ;)

greasedman
21st January 2005, 15:48
I've skipped this error using skip.io in before.rewrite section, (i don't need at this step to let the process do an update), but after, i've a message wich appears : "Record not modified" and i've to press the OK button.
How can I avoid this message, because the user has the possibility of
modifying several lines and several pages, so the message will appear a lot
Reading from BaaN Help, skip.io:
[...]
This specifies a message that is defined in the data dictionary. This message is displayed on screen when you call skip.io(). If you specify an empty string, the standard program displays a default message.
[...]

Isn't there a function like skip.io() with a possibility to display no message anyway?!?

Hitesh Shah
22nd January 2005, 14:03
Reading from BaaN Help, skip.io:
Isn't there a function like skip.io() with a possibility to display no message anyway?!?

Use the skip.io("") . It will not give any message.

greasedman
24th January 2005, 13:51
Use the skip.io("") . It will not give any message.
It will in some circumstances, I think when a default message from standard program is available, in other cases it won't... :confused:

mquinio
26th January 2005, 12:39
Use the skip.io("") . It will not give any message.

Hello ,
I tried this (skip.io("")) and, as said Greasedman, it will in some circumstances, but in my case the msg continue to appear.
thank's

Hitesh Shah
27th January 2005, 16:03
In before.rewrite , try the abort.io instead of skip.io .

mquinio
27th January 2005, 16:29
Hello,
The result is worth with the abort.io function, because i've always the msg "Record not modified" and after i've another message witch ask me if i want to retry another time the transaction.

greasedman
28th January 2005, 12:14
In before.rewrite , try the abort.io instead of skip.io .
I tried already, but the behavior is the same... I can't belive it's impossible to skip ANY message!!!

Hitesh Shah
28th January 2005, 16:48
There are certain message which are given by standard program (like the one on delete on any main table session) which can not be avoided.

Abort.io however will reduce the message to lesser number in case of multi-occ session. Help also is clear about message coming sometimes.

mquinio
1st February 2005, 11:37
Hello,
I'm sorry that nobody can help me on this way. So i've perhaps another idea to inhibit this problem. I noticed that when I pressed on escape key before clicking on a button, the posting of the msg was not done.
So, does somebody know how to simulate the esc key into the pgr ??

greasedman
1st February 2005, 12:47
execute(recover.set), it should be the same as esc

mquinio
3rd February 2005, 12:27
Yes, it was the solution, executing this function in the "choice.modify.set" section and the after.choice subsection, the before.rewrite subsection of the main.io section is not executed, so everything which was executed before is skipped and the msg doesn't appear.

Thank's a lot.