Sandy Blondino
16th August 2011, 21:48
Good afternoon,
I have a specific question about DAL's. I wrote a session to insert a record into the bptmm120 table using DAL functionality. I don't get any compile errors but I do get the following error "bptmm120.stdt not valid" when trying to insert the record.
I'm assuming the error is because I don't have the correct date format. I've tried using different formats, but I always get the same message and error code -12.

The domain for the date is tcutcm (utc format).
The session I wrote reads data from another table then tries the insert. All of the data types in the temp table match the data types in the target table.

I don't know what I'm doing wrong.
If anyone can help, I would appreciate it.

Thanks,
Sandy

ARijke
17th August 2011, 09:58
What happens when you do not set the stdt field? Or when you set it with utc.num()?

The functional checks done, are: date must be within the selected period and within employment period of the employee.

regards, Adriaan

Pieter van de L
17th August 2011, 10:25
Hi Sandy,

I use the following script to import hours

per.van = date.to.utc( year, month, day, 0, 0, 0 )
select tcccp070.*
from tcccp070
where tcccp070._index1 = {"HOUR"} and
tcccp070.stdt <= :per.van and
tcccp070.endt > :per.van
selectdo
endselect

select max(bptmm120.seqn):o.max.seqn
from bptmm120
where bptmm120._index1 = {:employee, :year,:tcccp070.peri}
as set with 1 rows
selectdo
seqn = o.max.seqn + 1
selectempty
seqn = 1
endselect

import.bptmm120()
if not isspace(mes.dal) then
mes1 = mes.dal
r.1.s.detail()
else
mes1 = "Imported " &ord_pro
r.1.s.detail()
endif



function import.bptmm120()
{
mes.dal = ""
if tijd = 0 then
tijd = 0.01
endif
dal.new.object("bptmm120")
dal.set.field("bptmm120.emno", medewerker)
dal.set.field("bptmm120.year", jaar)
dal.set.field("bptmm120.seqn", seqn)
dal.set.field("bptmm120.peri", tcccp070.peri)
dal.set.field("bptmm120.cuni", "UUR")
dal.set.field("bptmm120.hrea", tijd)
dal.set.field("bptmm120.chlt", loonsoort)
dal.set.field("bptmm120.orno", ord_pro)
dal.set.field("bptmm120.opno", bew_act)
dal.set.field("bptmm120.stdt", per.van)
if ready = "n" then
dal.set.field("bptmm120.perc", 0)
else
dal.set.field("bptmm120.perc", 100)
endif

ret = dal.save.object("bptmm120")

if ret< 0 then
ret=dal.get.error.message(mes.dal)
mes.dal = str$(ord_pro) &"_" &str$(bew_act)& " :" & mes.dal
dum = seq.puts(mes.dal, fp2)
open.error.file("hours","hours_erpln")
dum = seq.puts(regel,fp4)
dum = seq.close(fp4)
endif

commit.transaction()

}

Sandy Blondino
17th August 2011, 18:18
Hello,
Thanks for the responses, but unfortunately I'm still not successful.

When I don't set the stdt field or when I set it with utc.num(), I'm still getting the same error message.
I checked the date value and it is within range of the employment period of the employee.
I checked my code against the code posted by Pieter and it's comparable.
The DAL is active for the bptmm120 table.

I'm running out of options to check.
Is there something else in tools, like a parameter setting that might be set wrong?

Thanks for help,
Sandy

ARijke
17th August 2011, 20:33
Sandy, there can be multiple error messages. You can read in a loop the next error message or use show.error.message to get all message on the error message stack.
regards

vahdani
24th August 2011, 11:28
Hi Sandy,

is the problem solved? If not it would help if you could post your code.