rajesh_bamane
29th April 2009, 14:58
Hi,
I have created new customize session to create Production order using AFS.
I am able to create production order using AFS,now i want to update the Production order number in my customize table.
How can we known which order has created by AFS?
Can AFS return the production order number after creating the order?
Regards
Rajehs
Hitesh Shah
29th April 2009, 19:13
stpapi.get.field for tisfc001.pdno should give u the pdno once the order is saved successfully.
rajesh_bamane
30th April 2009, 08:52
Hi Hitesh,
Thanks for replay.
I am using following function to achive my requiremnet,also i used get.gield after insert function but still i am not getting the production number.
function extern void tisfcf0101m000.insert(domain tcgrno value,domain tcitem value1,domain tiqep1 value2)
{
stpapi.put.field("tisfc0101m000", "tisfc001.grno", str$(value))
stpapi.put.field("tisfc0101m000", "tisfc001.mitm", str$(value1))
stpapi.put.field("tisfc0101m000", "tisfc001.qrdr", str$(value2))
retval1= stpapi.insert( "tisfc0101m000", true, error.msg )
stpapi.get.field("tisfc0101m000","tisfc001.pdno",o.orno)
if not retval1=1 then
retval1 = stpapi.recover("tisfc0101m000", error.msg)
else
message("Record Inserted Successfully")
endif
stpapi.end.session("tisfc0101m000", error.msg)
}
Please suggest me the if any chnage is required.
Regards
Rajesh
saumya
30th April 2009, 09:16
Hi,
function extern void tisfcf0101m000.insert(domain tcgrno value,domain tcitem value1,domain tiqep1 value2)
{
stpapi.put.field("tisfc0101m000", "tisfc001.grno", str$(value))
stpapi.put.field("tisfc0101m000", "tisfc001.mitm", str$(value1))
stpapi.put.field("tisfc0101m000", "tisfc001.qrdr", str$(value2))
retval1= stpapi.insert( "tisfc0101m000", true, error.msg )
if not retval1=1 then
retval1 = stpapi.recover("tisfc0101m000", error.msg)
else
stpapi.get.field("tisfc0101m000","tisfc001.pdno",o.orno)
message("Record Inserted Successfully")
endif
stpapi.end.session("tisfc0101m000", error.msg)
}
Remember o.orno must be a string. later u can change it to long by lval() function.
rajesh_bamane
30th April 2009, 11:53
Hi saumya,
I have declared 0.orno as string only, but get.field is not returing me the current order number which is created by AFS.
Regards
Rajesh
Marioth
30th April 2009, 14:38
Hi Rajesh,
When we migrated from BaaNIV to LN they told us it was better to use the DAL functionality cos there are some interuptions with AFS. So we changed all of our sources with that principal. I enclosed an example for you maybe that will bring you on route.
EG.
function name
{
db.retry.point()
dal.new.object("tdsls400")
dal.set.field("tdsls400.ofbp", tdqry003.cuno)
if tdqry003.crdr = tdqry.crdr.crd then
| stpapi.put.field("tdsls4100m900","tdsls400.sotp","SR1")
dal.set.field("tdsls400.sotp", "SR1")
else
| stpapi.put.field("tdsls4100m900","tdsls400.sotp","DBT")
dal.set.field("tdsls400.sotp", "DBT")
endif
if tdsls400.sotp = "SR1" then
dal.set.field("tdsls400.orno", "9")
else
dal.set.field("tdsls400.orno", "8")
endif
dal.set.field("tdsls400.osrp", "")
dal.set.field("tdsls400.prno", "")
dal.set.field("tdsls400.prno", "")
if tdqry003.crdr = tdqry.crdr.dbt then
dal.set.field("tdsls400.retr", "")
else
dal.set.field("tdsls400.retr", "MCS005")
endif
| dal.set.field("tdsls400.ddat", str$(date.num()))
| dal.set.field("tdsls400.odat", str$(date.num()))
dal.set.field("tdsls400.ddat", str$(utc.num()))
dal.set.field("tdsls400.odat", str$(utc.num()))
dal.set.field("tdsls400.refa", qry.ref)
dal.set.field("tdsls400.refb", "Auto generated")
retval = dal.save.object("tdsls400")
message("%s",tdsls400.orno)
if retval < 0 then
retval = dal.get.error.message(err.mesg)
message("Error......!%s",err.mesg)
endif
commit.transaction()
}
Regards,
Mario
PS don't forget to include the DAL into your session as a liberary.
baan.kmurali
7th May 2009, 13:50
you can give the stpapi.get command at after the stpapi.insert command
eg:
stpapi.insert()
stpapi.get.field()
Thanks & Regards,
Murali.