kathuria
3rd December 2006, 10:43
Hi,

I wrote sales order AFS in SSA ERP 6.1. Any body can authenticate this asf code because this AFS is not working.

stpapi.put.field("tdsls4100m900","tdsls400.ofbp","CUS000003")
stpapi.put.field("tdsls4100m900","tdsls400.sotp","S01")
stpapi.put.field("tdsls4100m900","tdsls400.orno","DES")
stpapi.put.field("tdsls4100m900","tdsls400.cofc","SO")
stpapi.put.field("tdsls4100m900","tdsls400.ddat",str$(utc.num()))
ret = stpapi.change.view("tdsls4100m900", w.err.msg)
ret = stpapi.synchronize.dialog("tdsls4101m000", "modify", w.err.msg)
stpapi.put.field( "tdsls4101m000", "tdsls401.pono", "1" )
stpapi.put.field( "tdsls4101m000", "tdsls401.item.segment.2", "0714-020D-01" )
stpapi.put.field( "tdsls4101m000", "tdsls401.qoor", "100" )
stpapi.put.field( "tdsls4101m000", "tdsls401.cuqs", "nos" )
stpapi.put.field( "tdsls4101m000", "tdsls401.pric", "100" )
ret = stpapi.insert("tdsls4101m000", true, w.err.msg)
if not ret then
ret = stpapi.recover("tdsls4101m000", w.err.msg)
endif
stpapi.end.session("tdsls4101m000")
stpapi.end.session("tdsls4100m900")


Best Regards.
Sanjay Kathuria

mark_h
4th December 2006, 15:21
I can only point out the last post on this thread (http://www.baanboard.com/baanboard/showthread.php?t=25354&highlight=tdsls4101m000). It mentions using a library instead of AFS code. You can search for tdsls4101m000 to see if any of the other threads apply.

kathuria
5th December 2006, 05:51
Hi,

I have solved this problem by changed the natuer of session . This problem is only with SSA ERP LN 6.1 SP0. I am giving sequence in which i have solved th problem.

Step 1 : Copy session tdsls4100m000 to tdsls4100mpol and tdsls4101m000 to tdsls4101mpol
Step2 : Remove Session synchronization.
Step 3 : Chage session type from display to maintain.

After that I wrote the script on the basis of these sessions. Code is
function extern generate.sales.order()
{
stpapi.put.field("tdsls4100mpol", "tdsls400.ofbp", "CUS000003")
stpapi.put.field("tdsls4100mpol", "tdsls400.cofc", "SO")
stpapi.put.field("tdsls4100mpol", "tdsls400.sotp", "SNO")
stpapi.put.field("tdsls4100mpol", "tdsls400.orno", "DES")
ret = stpapi.insert("tdsls4100mpol", true, w.err.msg)
stpapi.get.field("tdsls4100mpol", "tdsls400.orno", m.orno)
message("%s",m.orno)
stpapi.end.session("tdsls4100mpol", w.err.msg)
fill.SO.lines()

}
function fill.SO.lines()
{
stpapi.put.field("tdsls4101mpol", "tdsls401.orno", m.orno)
ret = stpapi.change.view("tdsls4101mpol", w.err.msg)
ret = stpapi.synchronize.dialog("tdsls4101mpol", "modify", w.err.msg)
if ret then
stpapi.put.field("tdsls4101m000", "tdsls401.orno", m.orno)
stpapi.put.field("tdsls4101m000", "tdsls401.item.segment.1"," " )
stpapi.put.field("tdsls4101m000", "tdsls401.item.segment.2", "SW-0371")
stpapi.put.field("tdsls4101m000", "tdsls401.qoor", "10")
ret = stpapi.insert("tdsls4101m000", true, w.err.msg)
stpapi.end.session("tdsls4101m000", w.err.msg)
stpapi.end.session("tdsls4101mpol", w.err.msg)
endif


Regards,
Sanjay Kathuria

mark_h
5th December 2006, 14:37
Cool solution - hope this helps others.

NPRao
5th December 2006, 21:45
Few concerns, Sanjay:

tdsls4100m900 is a MMT session and AFS does not support MMT. Refer to the thread - AFS for Session Multi Main Table (http://www.baanboard.com/baanboard/showthread.php?t=28601&highlight=MMT)

Another good alternative solution is to implement is to use the DAL2 features/functions, refer to Evert's suggestions - Purchase order Upload SSA LN6.1 (http://www.baanboard.com/baanboard/showthread.php?t=25634&highlight=DAL2)