veyant
13th July 2004, 08:49
Hi,

Thru AFS i am creating sales order. AS qty and price was not getting updated so i updated them thru some function calls in table tdind017,tdsls041,tdsls051 & tdind203.

NOw order is ready but still Net Rate & Line Amount is not coming properly. AS if i go to that Sales Order Manually and table on price field session tdind0271s000 get activated and if i simply save & exit it after opening form.
The net Rate & Line Amount gets calculated.

So i was calling that session tdind0271s000 once again in end before closing tdsls4105s000 & tdsls4504s000 thru stpapi.end.session.
I just wrote following lines.

Now when i check it in debugger mode and it reaches at that point where i am calling this subsession again. It runs the code but actually it doesn't starts the session and when it reaches to PUT command, it gives error becoz no actual process is active in back-ground.

Spo please help. am i missing some thing. Pls correct me.

The code is here
function create.sales.order.lines()
{
f4101m000.handle.sub.process("tdsls4105s000","add")
stpapi.continue.process("tdsls4101m000",save.error)
stpapi.put.field("tdsls4105s000","tdsls040.orno",str$(order.no))
ret = stpapi.find("tdsls4105s000")
ret = f4105s000.find()

f4105s000.put.tdsls041.item(item)
f4105s000.put.Ordered_Quantity(ordered.qty)
suspend(2000)
f4105s000.handle.sub.process("tdind0271s000","add")
stpapi.continue.process("tdsls4105s000",insert.error.in.tdsls4105s000)
line.pono = f0271s000.get.posi.no()

f0271s000.put.base_date(tdspd981.odate) | For Base date
f0271s000.put.excise_applicable(excise.app) | For Line Excise
f0271s000.put.sales_tax_applicable(sls.app) | For Sales Tax Code
f0271s000.put.state_code(tdind019.scty)
f0271s000.put.sales_tax_code(tdind019.svat)
f0271s000.put.octroi_applicable(octr.app)
f0271s000.put.octroi_code(tdind019.octr)
f0271s000.put.srtx(ser.tax)
f0271s000.update(1,insert.error.in.tdind0271s000)
f0271s000.save(save.error)
f0271s000.end()
|======== updatuing quantity again as quantity inserted was 0 =====
f4105s000.insert(1,insert.error.in.tdsls4105s000)
f4105s000.handle.sub.process("tdind0271s000","kill")
f4105s000.put.ordered_quantity(ordered.qty)
f4105s000.update(1,insert.error.in.tdsls4105s000)

pono = f4105s000.get.position_number()
dummy.price = f4105s000.get.slsbasepr()
|======= updating price as price was not inserted thru AFS =======
if dummy.price = 0 then
get.price()
endif

|======= Calling subsession again to get the Line amount & net rate ==
f4105s000.handle.sub.process("tdind0271s000","add")
stpapi.continue.process("tdsls4105s000",insert.error.in.tdsls4105s000)
line.dis = 1

|========= Giving Error as process tdind0271s000 was not activated
|==== actually. I checked it thru Bshell. ===================

f0271s000.put.line_discount(line.dis)
f0271s000.update(1,insert.error.in.tdind0271s000)
f0271s000.save(save.error)
f0271s000.end()

f4105s000.save(save.error)
f4504s000.end()
f4105s000.end()
}

SriksAdi
15th July 2004, 10:48
Hi,
I have done a similar thing for session tdind0277s000. I am not sure if this works for ur sesison tdind0271s000.

Before calling the session tdind0271s000 select data from tdsls040, tdsls041 and tdsls045 for the order , position and sequence. In tdind0277s000, the script expects values from all the three tables mentioned above.

Declare a variable docu.type of type tdextr and assign it the value tdextr.sales or tdextr.purchase.

Let me know if it works.


regards
Sriks
PS: Script Follows
select tdpur045.*, tdpur041.*, tdpur040.*
from tdpur045, tdpur041, tdpur040
where tdpur045.orno = :tdpfl201.orno and
tdpur045.pono = :tdpfl201.pono and
tdpur045.srnb = :tdpfl201.srnb and
tdpur041.orno = tdpur045.orno and
tdpur041.pono = tdpur045.pono and
tdpur040.orno = tdpur045.orno
selectdo
break
endselect

docu.type = tdextr.purchase
dqua = lval(value)
stpapi.handle.subproc"tdpur4122m000" ,"tdind0277s000", "send")
value = str$(date.num())
stpapi.put.field("tdind0277s000", "base.dt", value)