Terminator
1st August 2006, 14:33
Sorry, my English very poor.
I want to calculate standart cost price for some item with AFS.
tiitm0101m000 -> menu -> ticpr2210s000
my code:
stpapi.put.field("tiitm0101m000", "tiitm001.item", tiitm001.item)
ret = stpapi.find("tiitm0101m000", error.msg)
if ret<>1 then message("Record not found")
else
stpapi.handle.subproc("tiitm0101m000", "ticpr2210s000", "add")
stpapi.zoom.option("tiitm0101m000", 1, "ticpr2210s000", error.msg)
If not isspace(error.msg) Then
message("AHTUNG!!! " & error.msg)
error.msg = ""
EndIF
stpapi.end.session("ticpr2210s000")
endif
stpapi.end.session("tiitm0101m000")
Both sessions starts and ends, but ticpr2210s000 nothing do - field tiitm001.copr=0.
Why?
mark_h
1st August 2006, 16:20
(1) Why not just run ticpr2210m000? If I have a main session I can use I always use it over a sub-session.
(2) I really do not think that is the right way to launch the menu, and pick the session. I have never really tried doing this - I think doug stroud posted an example that might work for Baan IV. Right now advance searching does not work for me - I think is login is dstroud and the post was in this forum.
Terminator
2nd August 2006, 12:43
(1) Ok, so why not work this code?
stpapi.put.field("ticpr2210m000", "item.f", tiitm001.item )
stpapi.put.field("ticpr2210m000", "item.t", tiitm001.item )
stpapi.put.field("ticpr2210m000", "cntr.f", " " )
stpapi.put.field("ticpr2210m000", "cntr.t", "zzz" )
stpapi.put.field("ticpr2210m000", "citg.f", " " )
stpapi.put.field("ticpr2210m000", "citg.t", "zzzzzz" )
stpapi.put.field("ticpr2210m000", "calc.cd", "001" )
stpapi.put.field("ticpr2210m000", "calc.meth", "1" )
stpapi.put.field("ticpr2210m000", "calc.date", date$)
stpapi.put.field("ticpr2210m000", "actualize.copr", "1")
stpapi.set.report("ticpr2210m000", "rticpr221001000", "D", err.mesg)
stpapi.continue.process("ticpr2210m000",err.mesg)
If not isspace(err.mesg) Then
message(err.mesg)
EndIF
stpapi.end.session("ticpr2210m000")
mark_h
3rd August 2006, 16:35
Thought this looked familiar
stpapi.put.field("ticpr2210m000","item.f","PLM7249037M")
stpapi.put.field("ticpr2210m000","item.t","PLM7249037M")
stpapi.put.field("ticpr2210m000","cntr.f","")
stpapi.put.field("ticpr2210m000","cntr.t","ZZZ")
stpapi.put.field("ticpr2210m000","citg.f","")
stpapi.put.field("ticpr2210m000","citg.t","ZZZZZZ")
stpapi.put.field("ticpr2210m000","calc.cd","CPC")
stpapi.put.field("ticpr2210m000","calc.date",str$(date.num()))
stpapi.put.field("ticpr2210m000","calc.meth",str$(etol(tcccmt.top.down)))
stpapi.put.field("ticpr2210m000","actualize.copr",str$(etol(tcyesno.yes)))
spool.device = "D66"
stpapi.set.report("ticpr2210m000","rticpr221001000",spool.device,msg)
stpapi.continue.process("ticpr2210m000",msg)
message("mess:%s",msg)
stpapi.end.session("ticpr2210m000")
This code worked for me at one time. I think there are other threads in this forum for this session. You probably should check with SSA on it. I still get the error report, but that is all I really checked.
Terminator
4th August 2006, 15:35
"calc.date", date$
VS
"calc.date",str$(date.num())
it's cool!
thank you very much!!!