janmeesters
23rd June 2011, 15:47
We're in FP7 SSA ERP LN now and i have problems migrating AFS script for purchasing lines

First we create a new batch because multi table forms don't work well with AFS.

This works. Then i look up the batch with AFS ( this works ) and try to insert a new document in tfacp1110s000 , i do this through tfgld1101m100

Logging doesn't show an error and as you can see i check the stpapi.i nsert. Seems the record is not inserted, and the next call for tfacp1120s000 goes wrong. Any ideas please.

Coding is below

stpapi.put.field("tfgld1101m100","tfgld101.btno",str$(save.lbno))
stpapi.find("tfgld1101m100",ret.mess)
stpapi.get.field("tfgld1101m100","tfgld101.btno",ret.mess)
message("tfgld1101m100 - batch nummmer is %1s",ret.mess)
stpapi.get.field("tfgld1101m100","tfgld101.ttyp",ret.mess)
message("tfgld1101m100 - ttyp is %1s",ret.mess)
stpapi.mark("tfgld1101m100",ret.mess)
| first open the sub-process tfacp1110s000
| stpapi.handle.subproc("tfgld1101m100", "tfacp1110s000","add")
stpapi.form.command("tfgld1101m100",5,"enter.transactions",ret.mess)
chck.ninv = 0
while not seq.eof(fd)
nr = seq.gets(buffer,255,fd)
| make sure not to import a line thats too short
if nr > -1 and len(buffer)>25
then
convert.line(buffer)
| now process the line
if chck.ninv <> save.ninv
then
stpapi.change.view("tfacp1110s000",ret.mess)
stpapi.put.field("tfacp1110s000","tfacp200.ttyp",str$(save.ttyp))
stpapi.put.field("tfacp1110s000","tfacp200.ninv",str$(save.ninv))
ret = stpapi.change.view("tfacp1110s000",ret.mess)
|message("tfacp1110s000 - insert van [%1s - %2s]",save.suno,str$(save.ninv))
stpapi.put.field("tfacp1110s000","tfacp200.ninv",str$(save.ninv))
stpapi.put.field("tfacp1110s000","tfacp200.appr","1")
stpapi.put.field("tfacp1110s000","tfacp200.orno","")
stpapi.put.field("tfacp1110s000","tfacp200.load","")
stpapi.put.field("tfacp1110s000","tfacp200.shpm","")
stpapi.put.field("tfacp1110s000","tfacp200.shpi","")
stpapi.put.field("tfacp1110s000","tfacp200.clus","")
stpapi.put.field("tfacp1110s000","tfacp200.ifbp",save.suno)
stpapi.put.field("tfacp1110s000","tfacp200.optb",save.suno)
stpapi.put.field("tfacp1110s000","taxnr","")
|stpapi.put.field("tfacp1110s000","tfacp200.ptyp","EXT")
stpapi.put.field("tfacp1110s000","tfacp200.isup",str$(save.refr))
stpapi.put.field("tfacp1110s000","tfacp200.docd",str$(save.dcdt))
stpapi.put.field("tfacp1110s000","screen.amnt",str$(save.bamf))
stpapi.put.field("tfacp1110s000","tfacp200.refr",save.desc)
stpapi.put.field("tfacp1110s000","tfacp200.lvat","2")
stpapi.put.field("tfacp1110s000","tfacp200.vaty",str$(save.fyer))
stpapi.put.field("tfacp1110s000","tfacp200.vatp",str$(save.fprd))
stpapi.put.field("tfacp1110s000","tfacp200.ccrs","")
|stpapi.put.field("tfacp1110s000","tfacp200.paym","")
stpapi.put.field("tfacp1110s000","tfacp200.reas","")
| now insert the record
ret = stpapi.insert("tfacp1110s000",true,ret.mess)
if ret = 0 then
message("tfacp1110s000 - fout in sessie : [%1s]",ret.mess)
ret2 = stpapi.recover("tfacp1110s000",ret.mess)
error = 1
else
message("tfacp1110s000 - Geen fout in sessie : [%1s]",ret.mess)
stpapi.handle.subproc("tfacp1110s000", "tfacp1120s000","add")
stpapi.form.command("tfacp1110s000",5,"exec.cont.process",ret.mess)
| save documentnbr
chck.ninv = save.ninv
stpapi.put.field("tfacp1120s000", "tfgld102.leac",str$(save.leac))
stpapi.put.field("tfacp1120s000", "tfgld102.dim1",str$(save.dim1))
stpapi.put.field("tfacp1120s000", "tfgld102.cvat",str$(save.cvat))
stpapi.put.field("tfacp1120s000", "amount",str$(save.amnt))
stpapi.put.field("tfacp1120s000", "tfgld102.vamt",str$(save.vamt))

stpapi.put.field("tfacp1120s000", "tfgld102.fyer",str$(save.fyer))
stpapi.put.field("tfacp1120s000", "tfgld102.ryer",str$(save.fprd))
ret = stpapi.insert("tfacp1120s000", true, ret.mess)
if ret = 0 then
message("tfacp1120s000 - fout in sessie : [%1s]",ret.mess)
ret2 = stpapi.recover("tfacp1120s000",ret.mess)
error = 1
else
stpapi.end.session("tfacp1120s000")
endif
endif
else
stpapi.handle.subproc("tfacp1110s000", "tfacp1120s000","add")
stpapi.form.command("tfacp1110s000",5,"exec.cont.process",ret.mess)
stpapi.put.field("tfacp1120s000", "tfgld102.leac",str$(save.leac))
stpapi.put.field("tfacp1120s000", "tfgld102.dim1",str$(save.dim1))
stpapi.put.field("tfacp1120s000", "tfgld102.cvat",str$(save.cvat))
stpapi.put.field("tfacp1120s000", "amount",str$(save.amnt))
stpapi.put.field("tfacp1120s000", "tfgld102.vamt",str$(save.vamt))
stpapi.put.field("tfacp1120s000", "tfgld102.fyer",str$(save.fyer))
stpapi.put.field("tfacp1120s000", "tfgld102.ryer",str$(save.fprd))
ret = stpapi.insert("tfacp1120s000", true, ret.mess)
if ret = 0 then
message("tfacp1120s000 - fout in sessie : [%1s]",ret.mess)
ret2 = stpapi.recover("tfacp1120s000",ret.mess)
error = 1
else
stpapi.end.session("tfacp1120s000")
endif
endif
endif
endwhile
stpapi.end.session("tfacp1110s000")
if error then
message("Fouten geconstateerd verwerking")
exit()
else
message("Programma klaar met verwerking")
endif


Logging

30serv<-4gl (start.set^AEOF^A0)
tfacp1110s000(30)-RUNNING:
<tfacp1110s000 0 no view found
>tfacp1110s000(30) put.field:tfacp200.ninv 2000877
>tfacp1110s000(30) put.field:tfacp200.appr 1
>tfacp1110s000(30) put.field:tfacp200.orno
>tfacp1110s000(30) put.field:tfacp200.load
>tfacp1110s000(30) put.field:tfacp200.shpm
>tfacp1110s000(30) put.field:tfacp200.shpi
>tfacp1110s000(30) put.field:tfacp200.clus
>tfacp1110s000(30) put.field:tfacp200.ifbp REL100712
>tfacp1110s000(30) put.field:tfacp200.optb REL100712
>tfacp1110s000(30) put.field:taxnr
>tfacp1110s000(30) put.field:tfacp200.isup 1508916
>tfacp1110s000(30) put.field:tfacp200.docd 734294
>tfacp1110s000(30) put.field:screen.amnt 119.96
>tfacp1110s000(30) put.field:tfacp200.refr vf+01508919
>tfacp1110s000(30) put.field:tfacp200.lvat 2
>tfacp1110s000(30) put.field:tfacp200.vaty 2011
>tfacp1110s000(30) put.field:tfacp200.vatp 6
>tfacp1110s000(30) put.field:tfacp200.ccrs
>tfacp1110s000(30) put.field:tfacp200.reas
>tfacp1110s000 insert
25dll->serv (add.set+save^A30)
tfacp1110s000(30)-RUNNING:add.set+save
30serv<-4gl (add.set+save^A0^A1)
tfacp1110s000(30)-RUNNING:
<tfacp1110s000
>tfacp1110s000 handle.subproc tfacp1120s000 add
25dll->serv (handle.subsession^Atfacp1120s000^A2^A30)
>tfacp1110s000 form.command command type: 5 command prog: exec.cont.process
25dll->serv (form.command^A5^Aexec.cont.process^A30)
tfacp1110s000(30)-RUNNING:form.command
30serv<-4gl (form.command^A0)
tfacp1110s000(30)-RUNNING:
<tfacp1110s000
25dll->serv (start^Atfacp1120s000^A1^A^A0^A0)
32serv<-4gl (api.child.startedtfacp1120s00025)
32serv<-4gl (init.ready)
tfacp1120s000(32)-RUNNING:
>tfacp1120s000(32) put.field:tfgld102.leac 600001
>tfacp1120s000(32) put.field:tfgld102.dim1 20000
>tfacp1120s000(32) put.field:tfgld102.cvat 104
>tfacp1120s000(32) put.field:amount 2.8
>tfacp1120s000(32) put.field:tfgld102.vamt 0.53
>tfacp1120s000(32) put.field:tfgld102.fyer 2011
>tfacp1120s000(32) put.field:tfgld102.ryer 6
>tfacp1120s000 insert
25dll->serv (add.set+save^A32)
tfacp1120s000(32)-RUNNING:add.set+save
32serv<-4gl (add.set+save^A1^A0)
tfacp1120s000(32)-RUNNING:
<tfacp1120s000 Koers niet aanwezig voor type valutakoers , valuta .
>tfacp1120s000 recover

rochus
23rd June 2011, 18:29
<tfacp1120s000 Koers niet aanwezig voor type valutakoers , valuta .

mark_h
23rd June 2011, 18:53
Doing dutch to english it says - "Rate not present for type valutakoers, currency". So there looks like a rate field that needs to be added. Also I think that stpapi.handle.subproc needs to be uncommented - I don't know LN, but in 4c3 that is needed for the link between parent and subsession.

JaapJD
23rd June 2011, 19:11
Solution 1016219 in Infor365 says that MMT handling has been implemented in AFS.

janmeesters
24th June 2011, 11:17
The problem with mmt i have a workaround, the batch is created with sql.

I then try to use afs to complete the process, i look up the batch , mark it and use enter.transactions functions to go to the next session.

No errors etc. but there isn't a record created in tfacp1110s000 , the next subsession tfacp1120s000 fails because it has no parent record.

Why no record is inserted beats me

rochus
24th June 2011, 15:41
i have dont this in ln more times until fp6.
it depends on the booking code, i had to add
stpapi.handle.subproc("tfacp1110s000","tfacp1111s000","add")

please alo check for isup (sometimes there is an duplicates-check)

rochus
24th June 2011, 15:44
please try also to set the "tfacp200.rade"