kishoremeher
30th September 2010, 06:48
Hi all,

I am trying to insert team wise record in table bptmm111( project and general Hours/Expenses) use DAL functions.
When i call the function dal.save.object(), i am getting error "The general task field must be empty in project and general Hours/Expenses". But system is allowing me to enter general task while entering throuth session(bptmm1111m200). If i put general task field empty then it is giving dublicate record error for table bptmm110.
Please help if anybody have came over this problem earlier.

here is attached script for referance.

ret_val = dal.new.object("bptmm111")
dal.set.field("bptmm111.emno","")
dal.set.field("bptmm111.year",2010)
dal.set.field("bptmm111.peri",39)
dal.set.field("bptmm111.type",1)
dal.set.field("bptmm111.seqn",5)
dal.set.field("bptmm111.cgrp","10100 ")
dal.set.field("bptmm111.cgrj","")
dal.set.field("bptmm111.cspa","")
dal.set.field("bptmm111.cact","")
dal.set.field("bptmm111.cstl","")
dal.set.field("bptmm111.swct",1)
dal.set.field("bptmm111.ccun","")
dal.set.field("bptmm111.gtsk","110")
dal.set.field("bptmm111.expn","")
dal.set.field("bptmm111.dsca","No Load")
dal.set.field("bptmm111.cpcp","BND")
dal.set.field("bptmm111.cwoc","20000 ")
dal.set.field("bptmm111.hrea",3,1)
dal.set.field("bptmm111.hrea",3,8)
dal.set.field("bptmm111.chlt","100")
dal.set.field("bptmm111.rgdt",0)
dal.set.field("bptmm111.trdt",utc.num())
dal.set.field("bptmm111.quan",0)
dal.set.field("bptmm111.cuni","hr")
dal.set.field("bptmm111.pric",0)
dal.set.field("bptmm111.ccur","")
dal.set.field("bptmm111.amnt",0)
dal.set.field("bptmm111.rdat",0)
dal.set.field("bptmm111.rate",0,1)
dal.set.field("bptmm111.ratf",0,1)
dal.set.field("bptmm111.cnfd",2)
dal.set.field("bptmm111.proc",2)
dal.set.field("bptmm111.hrdv",2)
dal.set.field("bptmm111.orig",1)
dal.set.field("bptmm111.blbl",2)
dal.set.field("bptmm111.agui","")

retval = dal.save.object("bptmm111",db.return.error)

Thanks,
Kishore

ARijke
30th September 2010, 13:19
You need to set the type first. Otherwise it is not known whether you try to register project or general hours.
You can set it first with the next logic:
dal.start.business.method(MAIN_TBL, "set.current.type",
retval, bptmm.type.project)

kishoremeher
1st October 2010, 11:46
Dear Arijke,

Thanks for the reply.

I used that function dal.start.business.method() but still i am getting the same error message.
May be i am not putting that function in right place or may be putting some wrong attributes.
I didn't get any help for that function.
Will U please help me with that.

Here is the sample program.


dal.start.business.method("bptmm111", "set.current.type",retval, bptmm.type.project)
ret_val = dal.new.object("bptmm111")
dal.set.field("bptmm111.emno","")
dal.set.field("bptmm111.year",2010)
dal.set.field("bptmm111.peri",39)
dal.set.field("bptmm111.type",1)
dal.set.field("bptmm111.cgrp","10100 ")
dal.set.field("bptmm111.swct",1)
dal.set.field("bptmm111.ccun","")
dal.set.field("bptmm111.gtsk","110")
dal.set.field("bptmm111.expn","")
dal.set.field("bptmm111.dsca","No Load")
dal.set.field("bptmm111.cpcp","BND")
dal.set.field("bptmm111.cwoc","20000 ")
dal.set.field("bptmm111.hrea",3,1)
dal.set.field("bptmm111.hrea",3,8)
dal.set.field("bptmm111.chlt","100")
dal.set.field("bptmm111.rgdt",0)
dal.set.field("bptmm111.trdt",utc.num())
dal.set.field("bptmm111.quan",0)
dal.set.field("bptmm111.cuni","hr")

retval = dal.save.object("bptmm111",db.return.error)

if retval = 0 then
commit.transaction()
message("Processed")
else
rt1 = dal.count.error.messages()
for i = 1 to rt1
ret_val = dal.get.error.message(error)
message("%s",error)
endfor
abort.transaction()
endif

Thanks,
kishore Meher

ARijke
6th October 2010, 09:45
Sorry I thought you wanted to create project hours - for that bptmm.project needs to be specified.
If you want create an entry of type general hours then bptmm.type.general must be specified.

Hope this helps
Adriaan

kishoremeher
7th October 2010, 07:10
HI Arijke,

Thanks for your help.
the function worked out.
dal.start.business.metho(MAIN_TBL, "set.current.type",retval, bptmm.type.project)

But instead of bptmm.type.project, we have to use bptmm.type.general.
Thanks again .

Regards,
Kishore