raikar_raviraj
13th February 2012, 13:33
Hi,
We have written an AFS code in ERP LN for execution of Confirm Receipt(tdpur4106m000) through PO Line Status session (tdpur4534m000).
But we are not able to achieve the end result.
Process executes completely, but it doesnt perform the intended functionality. DAL is not activated on tables, hence AFS is being used.
Find below the piece of code written.
function process()
|Function to call Print PO and Purchase Receipts session
{
long find.ret |Find Ret Value
domain tcmcs.st60m next.step |Next Step
stpapi.put.field("tdpur4534m000", "tdpur401.orno", pord)
stpapi.put.field("tdpur4534m000", "tdpur401.pono", str$(poln))
stpapi.put.field("tdpur4534m000", "tdpur401.sqnb", str$(pops))
find.ret = stpapi.find( "tdpur4534m000" , error)
stpapi.get.field("tdpur4534m000", "next.step", next.step )
if pos(next.step,"Print Purchase Orders") then
execute.Print.Purchase.Orders()
stpapi.get.field("tdpur4534m000", "next.step", next.step )
endif
if pos(next.step,"Purchase Receipts") then
execute.Purchase.Receipts()
endif
stpapi.end.session("tdpur4534m000" , error)
}
function execute.Print.Purchase.Orders()
|Function to execute Print PO
{
stpapi.handle.subproc("tdpur4534m000", "tdpur4401m000", "add")
stpapi.form.command("tdpur4534m000", 5, "execute.next.step", error)
stpapi.set.report("tdpur4401m000", "rtdpur440101000", "D", error)
stpapi.print.report("tdpur4401m000", error)
stpapi.end.session("tdpur4401m000" , error)
}
function execute.Purchase.Receipts()
||Function to execute Purchase Receipts
{
domain tcdate t
domain tcorno orno
domain tcpono pono
domain tcpono seqn
long retval
stpapi.form.command("tdpur4534m000", 5, "execute.next.step", error)
orno = tdpurf4106m000.get.Purchase_Order()
pono = tdpurf4106m000.get.Order_Line_Receipt()
seqn = tdpurf4106m000.get.Sequence()
tdpurf4106m000.put.Purchase_Order(pord)
tdpurf4106m000.put.Order_Line_Receipt(poln)
tdpurf4106m000.put.Sequence(pops)
t = utc.num()
tdpurf4106m000.put.Actual_Receipt_Date(t)
stpapi.put.field("tdpur4106m000", "tdpur406.rcno", "R3")
stpapi.put.field("tdpur4106m000", "tdpur406.fire", "tcyesno.no")
stpapi.put.field("tdpur4106m000", "form.qodl", str$(num_unit))
stpapi.put.field("tdpur4106m000", "tdpur406.qidl", str$(num_unit))
stpapi.form.command("tdpur4106m000", 5, "confirm.receipts", error)
stpapi.end.session("tdpur4106m000" , error)
}
One thing i have observed is values are not being passed in to the child session. Have written get.field function, but that doesnt return any value.
Please help.
We have written an AFS code in ERP LN for execution of Confirm Receipt(tdpur4106m000) through PO Line Status session (tdpur4534m000).
But we are not able to achieve the end result.
Process executes completely, but it doesnt perform the intended functionality. DAL is not activated on tables, hence AFS is being used.
Find below the piece of code written.
function process()
|Function to call Print PO and Purchase Receipts session
{
long find.ret |Find Ret Value
domain tcmcs.st60m next.step |Next Step
stpapi.put.field("tdpur4534m000", "tdpur401.orno", pord)
stpapi.put.field("tdpur4534m000", "tdpur401.pono", str$(poln))
stpapi.put.field("tdpur4534m000", "tdpur401.sqnb", str$(pops))
find.ret = stpapi.find( "tdpur4534m000" , error)
stpapi.get.field("tdpur4534m000", "next.step", next.step )
if pos(next.step,"Print Purchase Orders") then
execute.Print.Purchase.Orders()
stpapi.get.field("tdpur4534m000", "next.step", next.step )
endif
if pos(next.step,"Purchase Receipts") then
execute.Purchase.Receipts()
endif
stpapi.end.session("tdpur4534m000" , error)
}
function execute.Print.Purchase.Orders()
|Function to execute Print PO
{
stpapi.handle.subproc("tdpur4534m000", "tdpur4401m000", "add")
stpapi.form.command("tdpur4534m000", 5, "execute.next.step", error)
stpapi.set.report("tdpur4401m000", "rtdpur440101000", "D", error)
stpapi.print.report("tdpur4401m000", error)
stpapi.end.session("tdpur4401m000" , error)
}
function execute.Purchase.Receipts()
||Function to execute Purchase Receipts
{
domain tcdate t
domain tcorno orno
domain tcpono pono
domain tcpono seqn
long retval
stpapi.form.command("tdpur4534m000", 5, "execute.next.step", error)
orno = tdpurf4106m000.get.Purchase_Order()
pono = tdpurf4106m000.get.Order_Line_Receipt()
seqn = tdpurf4106m000.get.Sequence()
tdpurf4106m000.put.Purchase_Order(pord)
tdpurf4106m000.put.Order_Line_Receipt(poln)
tdpurf4106m000.put.Sequence(pops)
t = utc.num()
tdpurf4106m000.put.Actual_Receipt_Date(t)
stpapi.put.field("tdpur4106m000", "tdpur406.rcno", "R3")
stpapi.put.field("tdpur4106m000", "tdpur406.fire", "tcyesno.no")
stpapi.put.field("tdpur4106m000", "form.qodl", str$(num_unit))
stpapi.put.field("tdpur4106m000", "tdpur406.qidl", str$(num_unit))
stpapi.form.command("tdpur4106m000", 5, "confirm.receipts", error)
stpapi.end.session("tdpur4106m000" , error)
}
One thing i have observed is values are not being passed in to the child session. Have written get.field function, but that doesnt return any value.
Please help.