prashant
6th June 2008, 08:46
HI ALL,

I want to generate a sales order through afs in table(tdsls400).Firstly i copied the std. session(tdsls4100m900) and make it a customize session(tdmsl4100m900) to tackle the synchronized dialog problem for multi occurrence session.After that i write the simple afs coding which is given below,


function gen.orno(domain tcseri v.seri) {
string v.time(25),error.msg(100)
long v.dat

v.time = dte$()
v.time = v.time(7;2) & ":" & v.time(9;2) & ":" & v.time(11;2)

message("time %s",v.time)

stpapi.put.field("tdmsl4100m900","tdsls400.ofbp","CDMA00031")
stpapi.put.field("tdmsl4100m900","tdsls400.ofad","BUP000007")
stpapi.put.field("tdmsl4100m900","tdsls400.orno","800 ")
stpapi.put.field("tdmsl4100m900","tdsls400.sotp","S01")
stpapi.put.field("tdmsl4100m900","tdsls400.cofc","SLS001")
stpapi.put.field("tdmsl4100m900","tdsls400.odat",str$(date.num()))
stpapi.put.field("tdmsl4100m900","tdsls400.odat","v.time")
stpapi.put.field("tdmsl4100m900","tdsls400.ddat",str$(date.num() + 2))
stpapi.put.field("tdmsl4100m900","tdsls400.ddat","v.time")
stpapi.put.field("tdmsl4100m900","tdsls400.ccur","INR")

stpapi.insert("tdmsl4100m900",true,error.msg)

if isspace(error.msg) then
message("ORDER NO. %s is SUCCESSFULLY GENERATED",o.name)
else
message("Error %s",error.msg)
endif

stpapi.end.session("tdmsl4100m900")
}

But at the time of insertion a error is given which is "PLANNED DELIVERY DATE IS BEFORE OF ORDER DATE" after that insertion is aborted. :confused:

So,Pls. give some focus over this Problem.....

mark_h
6th June 2008, 13:50
Don't know about LN, but this looks wrong to me:

stpapi.put.field("tdmsl4100m900","tdsls400.odat",str$(date.num()))
stpapi.put.field("tdmsl4100m900","tdsls400.odat","v.time")
stpapi.put.field("tdmsl4100m900","tdsls400.ddat",str$(date.num() + 2))
stpapi.put.field("tdmsl4100m900","tdsls400.ddat","v.time")

Looks to me like you over-writing the date. Search thru this thread (http://www.baanboard.com/baanboard/showthread.php?t=28812&highlight=tdsls4100m900) and maybe follow the links to see how others did this UTC date and time.