smusba
17th January 2022, 10:43
Dear,

I had written a tdsls400 UE Script where it should allow the Original Document Invoice Number(ODIN) for more than one time.

I had wrtten in after.after.save. object.
This script even throws the error if the ODIN is entered for the first time.

g.comp = get.compnr()
if tdsls094.reto = ltoe(1) and g.comp<>400 then
r.foun = 0
d.orno = " "
n.orno = " "
select tdsls400.orno:d.orno
from tdsls400
|where tdsls400.orno(4;6) <> " "
where tdsls400.orno <> :tdsls400.orno
and tdsls400.rtyp = :tdsls400.rtyp
and tdsls400.odno = :tdsls400.odno
selectdo
n.orno = d.orno
r.foun = 9
if logname$ = "r.elsagg" or logname$ = "m.suhaib" then
if r.foun = 9 then |and VAL(tdsls400.odno)>0 or tdsls400.orno <> n.orno then |tdsls400.odno Added as there are many old invoices not linked
dal.set.error.message("@Duplicate Invoice Number !!Add lines in Sales Order !!!")
show.dal.messages()
return(-119)
endif
endif
selectempty
r.foun = 0
endselect
endif

JaapJD
17th January 2022, 13:09
Maybe you should remove "then |" from the condition...