frenny
6th July 2015, 09:16
hello,

I have written AFS on session tppdm6100m000 for insert project.
there is one question tppdm61003 ,i have tried to handle that question using stpapi.enum.answer() ,but it is not working.
i have tried this sentence at many place like after insert ,before insert ,after every stpapi.put.field ,but it' not working

this is my AFS


function extern boolean ltpdmdllafscal.tppdm6100m000.insert.project(
domain tccprj i.cprj, domain tcdsca i.desc,
domain tcemno i.pmng, domain tccom.cadr i.padr,
domain tcemm.grid i.eunt, domain tcccur i.curr,
domain tccotp i.proc, domain tppdm.kopr i.ptyp,
ref string ret.err)

{ long ret

stpapi.put.field("tppdm6100m000","tppdm600.cprj",i.cprj)
stpapi.enum.answer("tppdm6100m000","tppdm61003", tppdm.yeno.yes)
stpapi.put.field("tppdm6100m000","tppdm600.dsca",i.desc)
stpapi.put.field("tppdm6100m000","tppdm600.pmng",i.pmng)
stpapi.put.field("tppdm6100m000","tppdm600.padr",i.padr)
stpapi.put.field("tppdm6100m000","tppdm600.entu",i.eunt)
stpapi.put.field("tppdm6100m000","tppdm600.ccur",i.curr)
stpapi.put.field("tppdm6100m000","tppdm600.potp",i.proc)
stpapi.put.field("tppdm6100m000","tppdm600.kopr",str$(i.ptyp))

ret = stpapi.insert("tppdm6100m000",true,ret.err)
stpapi.end.session("tppdm6100m000")

if not ret then
return(false)
endif

return(true)

}

plz reply as early as possible

Thank you

bhushanchanda
6th July 2015, 09:29
Hi,

Please post your questions in related forums. Moved to correct forum - AFS/DDC/OLE : Function Servers.

When does't the message pops up? You can try it before even inserting the project field. Also, you can try passing the values for all the fields.

Apart from that, I guess you are on LN. So, go ahead and use DAL instead as it is just a record insert.

dal.new.object("tppdm600")
dal.set.field("tppdm600.dsca",i.desc)
dal.set.field("tppdm600.pmng",i.pmng)
dal.set.field("tppdm600.padr",i.padr)
dal.set.field("tppdm600.entu",i.eunt)
dal.set.field("tppdm600.ccur",i.curr)
dal.set.field("tppdm600.potp",i.proc)
dal.set.field("tppdm600.kopr",str$(i.ptyp))

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

if ret = 0 then
commit.transaction()
else
abort.transaction()
dal.get.error.message(err_msg)
message(err_msg)
endif

Also, I am not sure what is the field type for tppdm600.kopr. Is it enum? If yes, then you will need to pass the enum value in DAL.

benito
6th July 2015, 17:43
try putting the stpapi.enum.answer last. meaning put in this order: i.cprj, i.desc, etc, then at the last is the stpapi.enum.answer. if this doesn't work, use dal.

frenny
9th July 2015, 15:00
hello,
I have tried this with DAL ,Put all mandatory fields, but it still give and err that "Record not Inserted in Table Project For company XXX"

benito
9th July 2015, 15:11
try inserting a record through GTM. also when using DAL use a statement to capture the error message. you can use:

1) dal.get.error.message(err.msg)
2) show.dal.messages(MSG.ERROR)
3) show.dal.messages(MSG.ALL)