eric.dizon
11th June 2014, 23:27
I have created a session that reads in a Purchase Order excel file and put it on an interim sales order and lines table. I used AFS to convert the imported orders into a real LN Sales Order. The Sales Orders are created if the date are within the current date or greater.

If Order date is less than the current date I get this error on the snippet that inserts the Order Header data on the o.mess.

retval = tdslsf4100m900.insert(1, o.mess)
if not retval then |If insert fails
|Insert an entry on error log
create.log.entry(cxadi200.orno, 0, cxadi200.corn, "", cxadi.err.type.error, o.mess)
retval = stpapi.recover("tdsls4100m900", dummy.msg)
return (isspace(o.mess)) |Exit AFS process
else
g.pctr = g.pctr + 1
orno = tdslsf4100m900.get.Number()
endif

"Receipt Date before Order date. Receipt date will be changed to match order date".

But if I change the Order date to be >= the current date the AFS works.
I tried to proved that I can back date an order in a manual Sales Order Entry and I won't get an error. This manifest only in AFS Sales Order insert, Any ideas on how to overcome the issue and error that is showing when the Order date < Current date?

mark_h
11th June 2014, 23:34
Are these dates two dates are the form? Do you put both dates into the session?

I have seen something like this before - when you run a session manually some events get hit and change default screen values. When you run it using AFS code these events do not get hit and some fields might default differently. One of the reasons I always try to put all of the fields. Not sure this is the situation here.

eric.dizon
11th June 2014, 23:37
Mark yes the date field I am working with are :
tdsls400.odat
tdsls400.ddat
tdsls400.prdt

I tried populating those 3 dates but for some reason when I put odat < current date. I get the AFS issue. :(

mark_h
11th June 2014, 23:46
So is prdt the receipt date? When you run it manually and put in odat does it change prdt at all? I am wondering if in the AFS code you just put both dates in as the same date if it would work without an error. Maybe set them both to like current date -1 to test.