mig28mx
9th October 2013, 05:02
Hi all,
I´m writting a function using API functions to fill a customized table.
My code looks like:
function crea.linea()
{
stpapi.put.field("tfcmg9167m000", "tfcmg967.info", info.nuevo)
ret1 = stpapi.find("tfcmg9167m000", mensaje)
stpapi.handle.subproc("tfcmg9167m000", "tfcmg9168s001", "add")
stpapi.continue.process("tfcmg9167m000", mensaje)
stpapi.put.field("tfcmg9168s001", "tfcmg968.rfcf", rfcf)
stpapi.put.field("tfcmg9168s001", "tfcmg968.date", str$(date.num()))
stpapi.put.field("tfcmg9168s001", "tfcmg968.ccur", ccur)
stpapi.put.field("tfcmg9168s001", "tfcmg968.tick", str$(tcyesno.yes))
stpapi.put.field("tfcmg9168s001", "tfcmg968.ctra", ctra)
stpapi.put.field("tfcmg9168s001", "tfcmg968.dedu", str$(tcyesno.yes))
stpapi.put.field("tfcmg9168s001", "tfcmg968.tpay", tpay)
stpapi.put.field("tfcmg9168s001", "tfcmg968.tesp", str$(tesp))
stpapi.put.field("tfcmg9168s001", "tfcmg968.retn", str$(tcyesno.no))
stpapi.put.field("tfcmg9168s001", "tfcmg968.isup", str$(isup))
stpapi.put.field("tfcmg9168s001", "tfcmg968.dscr", desc)
stpapi.put.field("tfcmg9168s001", "tfcmg968.leac", leac)
stpapi.put.field("tfcmg9168s001", "tfcmg968.amnt", str$(amnl))
stpapi.put.field("tfcmg9168s001", "tfcmg968.tvat", str$(tcyesno.yes))
stpapi.put.field("tfcmg9168s001", "tfcmg968.ccty", ccty)
stpapi.put.field("tfcmg9168s001", "tfcmg968.cvat", cvat)
stpapi.put.field("tfcmg9168s001", "tfcmg968.vyer", str$(year))
stpapi.put.field("tfcmg9168s001", "tfcmg968.vprd", str$(fprd))
stpapi.put.field("tfcmg9168s001", "tfcmg968.leat", leat)
stpapi.put.field("tfcmg9168s001", "tfcmg968.vamt", str$(vamt))
stpapi.put.field("tfcmg9168s001", "tfcmg968.amth", str$(amnl))
stpapi.put.field("tfcmg9168s001", "tfcmg968.vamh", str$(vamt))
ret = stpapi.insert("tfcmg9168s001", true, mensaje)
if ret = 1 then
stpapi.get.field("tfcmg9168s001", "tfcmg968.lino", pono)
mensaje = sprintf$("Se creó Linea %s para el informe de gastos %s", pono, info.nuevo)
rprt_send()
num.linea = lval(pono)
tipo = 1
proce = 3
stpapi.end.session("tfcmg9168s001")
stpapi.end.session("tfcmg9167m000")
mensaje = ""
else
tipo = 2
proce = 3
mensaje = "Informe "&strip$(info.nuevo)&" "&mensaje
ret = stpapi.recover("tfcmg9168s001", mensaje)
stpapi.end.session("tfcmg9168s001")
stpapi.end.session("tfcmg9167m000")
reg.erroneos = reg.erroneos + 1
error = true
endif
}
and I allways got a message "Currency not defined".
I checked the code where that fills that code and I found the following:
field.tfcmg968.ccur:
before.input:
tfcmg968.ccur = main.ccur
attr.input = false
before.zoom:
tcmcs002.ccur = tfcmg968.ccur
check.input:
select tcmcs002.ccur
from tcmcs002
where tcmcs002._index1 = {:tfcmg968.ccur}
selectdo
selectempty
mensaje("Divisa no definida")
set.input.error("")
endselect
I believe this is why the AFS function is not working.
I tried to define main.curr variable on the program but I have the same result.
Any ideas?
Thank you in advance.
I´m writting a function using API functions to fill a customized table.
My code looks like:
function crea.linea()
{
stpapi.put.field("tfcmg9167m000", "tfcmg967.info", info.nuevo)
ret1 = stpapi.find("tfcmg9167m000", mensaje)
stpapi.handle.subproc("tfcmg9167m000", "tfcmg9168s001", "add")
stpapi.continue.process("tfcmg9167m000", mensaje)
stpapi.put.field("tfcmg9168s001", "tfcmg968.rfcf", rfcf)
stpapi.put.field("tfcmg9168s001", "tfcmg968.date", str$(date.num()))
stpapi.put.field("tfcmg9168s001", "tfcmg968.ccur", ccur)
stpapi.put.field("tfcmg9168s001", "tfcmg968.tick", str$(tcyesno.yes))
stpapi.put.field("tfcmg9168s001", "tfcmg968.ctra", ctra)
stpapi.put.field("tfcmg9168s001", "tfcmg968.dedu", str$(tcyesno.yes))
stpapi.put.field("tfcmg9168s001", "tfcmg968.tpay", tpay)
stpapi.put.field("tfcmg9168s001", "tfcmg968.tesp", str$(tesp))
stpapi.put.field("tfcmg9168s001", "tfcmg968.retn", str$(tcyesno.no))
stpapi.put.field("tfcmg9168s001", "tfcmg968.isup", str$(isup))
stpapi.put.field("tfcmg9168s001", "tfcmg968.dscr", desc)
stpapi.put.field("tfcmg9168s001", "tfcmg968.leac", leac)
stpapi.put.field("tfcmg9168s001", "tfcmg968.amnt", str$(amnl))
stpapi.put.field("tfcmg9168s001", "tfcmg968.tvat", str$(tcyesno.yes))
stpapi.put.field("tfcmg9168s001", "tfcmg968.ccty", ccty)
stpapi.put.field("tfcmg9168s001", "tfcmg968.cvat", cvat)
stpapi.put.field("tfcmg9168s001", "tfcmg968.vyer", str$(year))
stpapi.put.field("tfcmg9168s001", "tfcmg968.vprd", str$(fprd))
stpapi.put.field("tfcmg9168s001", "tfcmg968.leat", leat)
stpapi.put.field("tfcmg9168s001", "tfcmg968.vamt", str$(vamt))
stpapi.put.field("tfcmg9168s001", "tfcmg968.amth", str$(amnl))
stpapi.put.field("tfcmg9168s001", "tfcmg968.vamh", str$(vamt))
ret = stpapi.insert("tfcmg9168s001", true, mensaje)
if ret = 1 then
stpapi.get.field("tfcmg9168s001", "tfcmg968.lino", pono)
mensaje = sprintf$("Se creó Linea %s para el informe de gastos %s", pono, info.nuevo)
rprt_send()
num.linea = lval(pono)
tipo = 1
proce = 3
stpapi.end.session("tfcmg9168s001")
stpapi.end.session("tfcmg9167m000")
mensaje = ""
else
tipo = 2
proce = 3
mensaje = "Informe "&strip$(info.nuevo)&" "&mensaje
ret = stpapi.recover("tfcmg9168s001", mensaje)
stpapi.end.session("tfcmg9168s001")
stpapi.end.session("tfcmg9167m000")
reg.erroneos = reg.erroneos + 1
error = true
endif
}
and I allways got a message "Currency not defined".
I checked the code where that fills that code and I found the following:
field.tfcmg968.ccur:
before.input:
tfcmg968.ccur = main.ccur
attr.input = false
before.zoom:
tcmcs002.ccur = tfcmg968.ccur
check.input:
select tcmcs002.ccur
from tcmcs002
where tcmcs002._index1 = {:tfcmg968.ccur}
selectdo
selectempty
mensaje("Divisa no definida")
set.input.error("")
endselect
I believe this is why the AFS function is not working.
I tried to define main.curr variable on the program but I have the same result.
Any ideas?
Thank you in advance.