ben.kansas
24th November 2009, 00:08
Howdy all,
I am using AFS in a 3GL session to reset the scrap factor for a released production order to zero.
However, when the session runs the code executes perfectly, but there are no changes made to the database.
Any help would be appreciated.
|****************************** DECLARATION SECTION ***************************
table tticst001
table ttisfc001
table ttilit450
#pragma used dll ottstpapihand
|****************************** PROGRAM SECTION ***************************
|****************************** ZOOM FROM SECTION ***************************
|****************************** FORM SECTION ***************************
|****************************** CHOICE SECTION ***************************
|****************************** FIELD SECTION ***************************
|****************************** MAIN TABLE SECTION ***************************
|****************************** FUNCTION SECTION ***************************
function main()
{
domain tcdesc session
domain tcdesc error.msg
domain tcpdno prod.order
long return.val
long ret.val
long no.scrap.factor
return.val = 0
ret.val = 0
session = "tisfc0110m000"
SELECT tisfc001.pdno, tisfc001.osta, ticst001.*
FROM ticst001, tisfc001
WHERE tisfc001.pdno = ticst001.pdno
AND tisfc001.osta = tcosta.in.prod
AND ticst001.scpf > 0
SELECTDO
no.scrap.factor = 0
SELECT *
FROM tilit450
SELECTDO
if(ticst001.cwar = tilit450.cwar)then
no.scrap.factor = 1
endif
ENDSELECT
if(no.scrap.factor = 0)then
stpapi.put.field(session, "ticst001.pdno", str$(ticst001.pdno))
stpapi.put.field(session, "ticst001.pono", str$(ticst001.pono))
return.val = stpapi.find(session, error.msg)
if(return.val = 1) then
stpapi.put.field(session, "ticst001.scpf", "0")
endif
|ret.val = stpapi.update(session, 1, error.msg)
ret.val = stpapi.save(session, error.msg)
if(not ret.val) then
return.val = stpapi.recover(session, error.msg)
endif
stpapi.end.session(session)
endif
ENDSELECT
}
Thanks,
Ben
I am using AFS in a 3GL session to reset the scrap factor for a released production order to zero.
However, when the session runs the code executes perfectly, but there are no changes made to the database.
Any help would be appreciated.
|****************************** DECLARATION SECTION ***************************
table tticst001
table ttisfc001
table ttilit450
#pragma used dll ottstpapihand
|****************************** PROGRAM SECTION ***************************
|****************************** ZOOM FROM SECTION ***************************
|****************************** FORM SECTION ***************************
|****************************** CHOICE SECTION ***************************
|****************************** FIELD SECTION ***************************
|****************************** MAIN TABLE SECTION ***************************
|****************************** FUNCTION SECTION ***************************
function main()
{
domain tcdesc session
domain tcdesc error.msg
domain tcpdno prod.order
long return.val
long ret.val
long no.scrap.factor
return.val = 0
ret.val = 0
session = "tisfc0110m000"
SELECT tisfc001.pdno, tisfc001.osta, ticst001.*
FROM ticst001, tisfc001
WHERE tisfc001.pdno = ticst001.pdno
AND tisfc001.osta = tcosta.in.prod
AND ticst001.scpf > 0
SELECTDO
no.scrap.factor = 0
SELECT *
FROM tilit450
SELECTDO
if(ticst001.cwar = tilit450.cwar)then
no.scrap.factor = 1
endif
ENDSELECT
if(no.scrap.factor = 0)then
stpapi.put.field(session, "ticst001.pdno", str$(ticst001.pdno))
stpapi.put.field(session, "ticst001.pono", str$(ticst001.pono))
return.val = stpapi.find(session, error.msg)
if(return.val = 1) then
stpapi.put.field(session, "ticst001.scpf", "0")
endif
|ret.val = stpapi.update(session, 1, error.msg)
ret.val = stpapi.save(session, error.msg)
if(not ret.val) then
return.val = stpapi.recover(session, error.msg)
endif
stpapi.end.session(session)
endif
ENDSELECT
}
Thanks,
Ben