kruyoupatel
13th August 2014, 14:15
Hello All,
Can anybody help to get correct AFS to execute "tpppc2511m000" session from "tfacp1120s000" session.
I did tried to write AFS but nothing works properly.
I did RnD and was amused to see that standard script calls "tpppc2511m000" session using 3gl.
What actually happens is "tfacp1120s000" session calls tpppc2811m000 through dll using start.session command and this "tpppc2811m000" session has 3gl attached to it which executes "tpppc2511m000" session.
As there is an 3GL intermediate session i am unable to have "stpapi.subproc AFS" call on "tpppc2511m000" session, it opens the session as front end process instead of backend process.
mark_h
13th August 2014, 16:24
This is 4c4 code and I do not have source code to look at. This was one of the tougher ones for me to solve - while not the same sessions you mention it does launch tpppc2811m000 to get to 2111m000. This is just a piece of the code - there is a couple of what they call ZRC and AP5 transactions. You will notice that the call to tuddc9120m000 is actually running code to kill a background process, because an actual stpapi.end hangs. Second or third time I had to use this type of kill in some code. Hopefully this gives you some ideas on getting yours running.
function create.zrcb1()
{
errmsg = ""
errmsg1= ""
| 1. tfgld1100m000 (Maintain Transactions)
| 1.0 Input Batch data
stpapi.put.field("tfgld1100m000", "tfgld100.year", str$(c.yyyy))
stpapi.put.field("tfgld1100m000", "tfgld100.btno", str$(s.btno))
rc = stpapi.find("tfgld1100m000", errmsg)
| Start Session tfgld1101s000 ... Insert CTR transaction holder
stpapi.handle.subproc("tfgld1100m000", "tfgld1101s000", "add")
stpapi.continue.process("tfgld1100m000",errmsg)
stpapi.put.field("tfgld1101s000", "tfgld101.year", str$(c.yyyy))
stpapi.put.field("tfgld1101s000", "tfgld101.btno", str$(s.btno))
stpapi.put.field("tfgld1101s000", "tfgld101.ttyp", "ZRC")
rc = stpapi.find("tfgld1101s000", errmsg)
if rc<>1 then
errmsg1 = "9." & "ZRC not found"
stpapi.end.session("tfgld1101s000")
stpapi.end.session("tfgld1100m000")
return
endif
stpapi.handle.subproc("tfgld1101s000", "tfacp1110s000", "add")
stpapi.continue.process("tfgld1101s000", errmsg)
stpapi.save("tfacp1110s000",errmsg)
stpapi.handle.subproc("tfacp1110s000", "tfacp1130s000", "add")
stpapi.continue.process("tfacp1110s000", errmsg) | should start 1130 and 1131s
stpapi.end.session("tfacp1131s000",errmsg)
stpapi.handle.subproc("tfacp1130s000", "tfacp1140s000", "add")
stpapi.application.option( "tfacp1130s000", 1, 0, errmsg ) | Approve button
| Now 1133 is running.
stpapi.put.field("tfacp1133s000","tfacp101.leac", "CCN")
stpapi.handle.subproc("tfacp1133s000", "tpppc2811m000", "add")
stpapi.insert("tfacp1133s000",1, errmsg)
select tdpur951.*, tipgc820.cspa
from tdpur951, tipgc820
where tdpur951._index1 = {:tdudi050.orno,
:tdudi050.line} and
tipgc820.cprj = tdpur951.cprj and
tipgc820.butm = tdpur951.butm and
tipgc820.sbtm = tdpur951.sbtm and
tipgc820.prog = tdpur951.prog and
tipgc820.eser = tdpur951.eser and
tipgc820.unfr <= tdpur951.eseq and
tipgc820.unto >= tdpur951.eseq
as set with 1 rows
selectdo
endselect
stpapi.put.field("tpppc2111m000","tpppc211.cprj", tdpur951.cprj)
stpapi.put.field("tpppc2111m000","tpppc211.item", "MISC MATL")
stpapi.put.field("tpppc2111m000","tpppc211.cspa", tipgc820.cspa)
stpapi.put.field("tpppc2111m000","tpppc211.ccco", "287")
stpapi.put.field("tpppc2111m000","reasoncode", "BUY")
stpapi.insert("tpppc2111m000",1, errmsg)
if not isspace(errmsg) then
errmsg1 = "9a" & errmsg
endif
baan.sess = "tpppc2811m000"
export("ppid",ppid)
export("baan.sess",baan.sess)
rc = activate("tuddc9120m000")
stpapi.end.session("tpppc2811m000",errmsg)
stpapi.end.session("tfacp1133s000",errmsg)
stpapi.end.session("tfacp1140s000",errmsg)
stpapi.end.session("tfacp1130s000",errmsg)
stpapi.end.session("tfacp1110s000",errmsg)
stpapi.end.session("tfgld1101s000",errmsg)
stpapi.end.session("tfgld1100m000",errmsg)
}