User33
10th May 2011, 15:25
Hello,

I have a problem which iI don't know how to solve:

In session tdsls045, instead of entering item code in form, I wanted to make some subsession (menu tdsls00009002), in which I would make some additional checks on item which is not part of standard BaaN.

I made a session (modal child dialog), in which I use import and export command.
Problem is, that sometimes (but not every time), program make updates on my original order (tdsls041.orno), but in teh same time, it updates a record in next or in previous order.

When I look in the debugger, it shows that orno = original order until I go to filed item, after that orno is incremented by one.

Do you have any idea about it?



|******************************************************************************


|****************************** declaration section ***************************
declaration:

table ttiitm001
table ttcmcs022
table ttcmcs015
table ttdsls040
table tzipre900 | my table

table ttccom010


table ttdsls041

extern domain tcitem zoom.item, polje, polje2, item
extern domain tcmcs.st11 eseq
extern domain tcdscb dscd
extern domain tccsel csel | trzište
extern domain tcctyp ctyp |tip proizvoda
extern domain tcorno orno
extern domain tcpono pono
extern domain tcnama nama
extern domain tccuno cuno
extern domain tcdsca opis.trzista, opis.proizvoda
extern domain tcqsl1 oqua
extern domain tccuni cuqs



extern domain tccuno pctx
extern domain tcnama pctx.nama
extern domain tcdscb oval, kval
extern domain zipre.brbx duzn, sirn, visn

extern domain tcwght m2
extern domain tcpric pric, pric.kom
extern domain tcccur ccur
extern domain tcdate odat
extern domain tccplt cpls

extern domain tcmcs.st30 eono
extern domain tcdsca item.dsca
extern domain tcmcs.st15 ponuda

extern domain tcqono qono
extern domain tcpono qpon

long status





|****** before.program
before.program:
item = " "
oqua = 0
m2 = 0
pric = 0
odat = 0
cpls = ""
item.dsca = ""
eono = ""



|******** zoom section
zoom.from.all:
on.entry:

import("tdsls041.item", item)
import("tdsls041.orno", orno)
import("tdsls041.pono", pono)
import("tdsls041.cuno", cuno)
import("tdsls041.oqua", oqua)
import("tdsls041.odat", odat)
import("tdsls041.pric", pric)
import("tdsls040.cpls", cpls)
import("tdsls040.pctx", pctx)
import("tdsls041.cuqs", cuqs)

if not isspace(item) then
select zipre900.*, tiitm001.dsca:item.dsca, tiitm001.cups
from zipre900, tiitm001
where zipre900._index1 = {:item}
and tiitm001._index1 = {:item}
as set with 1 rows
selectdo
m2 = zipre900.mkom * oqua
oval = zipre900.oval
kval = zipre900.kval
duzn = zipre900.duzn
sirn = zipre900.sirn
visn = zipre900.visn

selectempty
item.dsca = " "
message("Nije u dodatnima!")
stop()
endselect
endif


display.all()

on.exit:


export("tdsls041.item", item)
export("tdsls041.oqua", oqua)
export("tdsls041.eono", eono)



|****************************** form section **********************************

form.1:
init.form:
|get.screen.defaults()




|*************************** field section ****************************************

field.item:
check.input:
select tiitm001.*, zipre900.*
from tiitm001, zipre900
where tiitm001._index1 = {:item}
and tiitm001.item refers to zipre900
as set with 1 rows
selectdo

item = tiitm001.item
item.dsca = tiitm001.dsca

m2 = zipre900.mkom * oqua
oval = zipre900.oval
kval = zipre900.kval
duzn = zipre900.duzn
sirn = zipre900.sirn
visn = zipre900.visn



selectempty
choice.again()

endselect



after.field:
display("item.dsca")

mark_h
10th May 2011, 21:56
Try checking what tdsls041.orno is as you move thru this script in debug mode. Something in the background might be changing it. Not really sure what that could be. I never use table fields for export and import.

User33
11th May 2011, 08:16
I already tried it. tdsls041.orno remain the same during on.entry part, but when I go to the field item, before.field: stays original orno, on after.field:, or when.field.changes:, or check.input: changes the tdsls041.orno.

I tried to do it with api, but the problem was the same.

Do you have any idea how to put item and quantity into sales order?

thanky you.

mark_h
11th May 2011, 15:41
So in the before.field the tdsls041.orno stays the same order number everytime? If yes can't you just reset the order number?

Do you have the standard baan session source code? It sounds like that is what is the problem. There is something in the way the two sessions are working that must be causing that order number to increase.

Something else I would change - but I don't see how it is related, maybe it is:

where zipre900._index1 = {:item}
and tiitm001._index1 = {:item}

to something like this

where zipre900._index1 = {:item}
and tiitm001._index1 = {zipre900.item}