alanfan
30th August 2015, 14:15
Dear Colleague,

I want to import the working hours from excel to ln session bptmm1120m000(table :bptmm120) automatically , But it is not sucessful and there is error about ret equal -12 when I debug this program.

I designed some another tools were sucessful such as import item from excel list to tcib0501m000 automatically

But I don't know why is not ok about this case , Do you have the experience that is import the working hours from excel to ln bptmm1120m000 automatically or could you help me to solve this problem?

Below attached file is the excel format an there is VAB program in it , it will call the object "obptmm9036" which object were writen in baan program script

Thank you in advance and expecting you can help me to solve the case


Alan

bhushanchanda
31st August 2015, 14:15
Hi,

Use dal.get.error.message (ref string mesg) after dal.save.object to get the error message.

string err.msg(100)

|...dal statements

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

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

benito
31st August 2015, 21:18
this works for me using a different session



sess = "bptmm1201m000"
err.id = ""
err.msg = ""

stpapi.put.field( sess, "ppl.type", str$(tcppl.type.empl) )
stpapi.put.field( sess, "emno.f", i.emno )
stpapi.put.field( sess, "emno.t", i.emno )
stpapi.put.field( sess, "tran.type", str$(bptmm.type.general) )
stpapi.put.field( sess, "gtsk", "238" )
stpapi.put.field( sess, "gtyp", str$(bpckot.indirect) )
stpapi.put.field( sess, "gtwc", i.cwoc )
stpapi.put.field( sess, "gtcp", "LAB" )
stpapi.put.field( sess, "start.date", str$(i.start.date) )
stpapi.put.field( sess, "end.date", str$(i.end.date) )
stpapi.put.field( sess, "cuni", "hr" )
stpapi.put.field( sess, "nhrs", str$(i.nhrs) )
stpapi.put.field( sess, "chlt", "REG" )

stpapi.set.report(sess, "rbptmm120011001","ASCIF", set.report.msg)

if isspace(set.report.msg) then
stpapi.form.command(sess, 5, "exec.cont.process", continue.msg)
else
dal.set.error.message("@" & trim$(set.report.msg))
stpapi.end.session( sess, end.msg )
abort.transaction()
endif

alanfan
1st September 2015, 05:44
Dear Colleague,

Thanks for your information,
1) We are using bptmm1120m000 to report hours ,
2) After update the script as below , System give us the message that is "The Labor Time field must be empty in Production Order Data", But actually, The work centor 1120 is man capacity in tirou01201m000 , The means is we have to input man hours in production .
2.1)attached excel file is format about "import working hours from excel to baan automatically", There is picture of more information
2.3 attached txt file is session script what I upated by your told.

Could you teach me how to solve it ? Thank you very much.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
string err.msg(100)
|...dal statements
ret = dal.save.object("bptmm120")
if ret = 0 then
commit.transaction()
else
dal.get.error.message (err.msg)
endif