kathuria
19th June 2007, 14:08
Hi,
I am able to create batch manual in SSA ERP LN 6.1 FP3 but not able to create batch by AFS. It was working fine earlier but not now. Any body can help me to resolve this problem. I am also attaching code here.
stpapi.put.field("tfgld1101m000","tedt.df",str$(date.num()))
stpapi.put.field("tfgld1101m000","tfgld101.year","2007")
stpapi.put.field("tfgld1101m000","fprd.f","08")
stpapi.put.field("tfgld1101m000","rprd.f","08")
stpapi.put.field("tfgld1101m000","bref.f","Test-Sanjay")
stpapi.put.field("tfgld1101m000","vyer.f","2007")
stpapi.put.field("tfgld1101m000","vprd.f","02")
ret = stpapi.change.view("tfgld1101m000",w.err.msg)
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","AMI")
ret = stpapi.insert("tfgld1101m000", true, w.err.msg)
stpapi.end.session("tfgld1101m000",w.err.msg)
Regards,
Sanjay
mark_h
19th June 2007, 15:39
What has changed since it was working? Have you all installed any patches? What exactly is happening now? Where is it failing and what error messages are you getting?
kathuria
19th June 2007, 15:48
Dear All,
After lot of efforts I am able to solve this problem . I am attaching here final code and that will be helpfull to other.
ret = stpapi.browse.view("tfgld1101m000", "last.view", w.err.msg)
stpapi.put.field("tfgld1101m000","tedt.df",str$(date.num()))
stpapi.put.field("tfgld1101m000","tfgld101.year","2007")
stpapi.put.field("tfgld1101m000","fprd.f","08")
stpapi.put.field("tfgld1101m000","rprd.f","08")
stpapi.put.field("tfgld1101m000","bref.f","Test-Sanjay")
stpapi.put.field("tfgld1101m000","vyer.f","2007")
stpapi.put.field("tfgld1101m000","vprd.f","03")
ret = stpapi.change.view("tfgld1101m000",w.err.msg)
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","AMI")
ret = stpapi.insert("tfgld1101m000", true, w.err.msg)
stpapi.end.session("tfgld1101m000",w.err.msg)
Regards,
Sanjay
mark_h
19th June 2007, 15:55
Well it works - does not make sense, but I had to do something like that to get a batch created. We use tfgld1100m000 and tfgld1101s000 to create a batch.
sess.gld1100 = "tfgld1100m000"
sess.gld1101 = "tfgld1101s000"
| 1. tfgld1100m000 (Maintain Transactions)
| 1.0 Input Batch data
stpapi.put.field(sess.gld1100, "tfgld100.tedt", str$(date.num()))
stpapi.put.field(sess.gld1100, "tfgld100.year", str$(c.yyyy))
stpapi.put.field(sess.gld1100, "tfgld100.btno", str$(c.btno))
stpapi.put.field(sess.gld1100, "tfgld100.bref", sprintf$("Contractor Labor (%02d/%02d/%02d)", mm,dd,yyyy\100))
stpapi.put.field(sess.gld1100, "tfgld100.fprd", str$(c.fprd))
stpapi.put.field(sess.gld1100, "tfgld100.rprd", str$(c.rprd))
stpapi.put.field(sess.gld1100, "tfgld100.vyer", str$(c.yyyy))
stpapi.put.field(sess.gld1100, "tfgld100.vprd", str$(c.vprd))
| 1.1 Insert a batch record
rc = stpapi.insert(sess.gld1100, 1, e.msg)
if not isspace(e.msg) then
stpapi.end.session(sess.gld1100)
return
endif
save.year = c.yyyy | used to update the contractor pro forma header
save.btno = c.btno
stpapi.get.field(sess.gld1100, "tfgld100.tedt", io.fld)
io.date = lval(io.fld)
str.date = num.to.date$(io.date, 2)
| Start Session tfgld1101s000 ... Insert CTR transaction holder
stpapi.handle.subproc(sess.gld1100, sess.gld1101, "add")
| 1.2 Select Continue button
stpapi.continue.process(sess.gld1100, e.msg)
|
stpapi.save(sess.gld1101,e.msg)
| 2. tfgld1101s000 (Maintain Transactions)
| 2.0 Input Batch transaction type
stpapi.put.field(sess.gld1101, "tfgld101.ttyp", "CTR")
| 2.1 Insert a CTR transaction into that batch
rc = stpapi.insert(sess.gld1101, 1, e.msg)
Notice how when 1101s000 is activated I do a save to start it out. One of the things that makes the AFS so much fun.