malutz
20th December 2004, 16:21
I am trying to write a function which allows me to select a certain field from a table and return the sum of that field. What I came up with looks like this. As you can imagine, it does not work. :) Otherwise I would not write this.
The compiler claims that:
column cprmp300.##field## does not exist.
Does anyone have an idea on how I can solve this?
function extern domain cpcom.quan zsrmp.dll0001.get.master.plan(domain cpcom.plnc i.plnc fixed,
domain cpcom.plvl i.plvl,
domain cpitem i.plni fixed,
domain cpcom.sern i.pern,
domain tcmcs.chan i.chan fixed,
domain ttadv.fdnm i.field)
{
domain cpcom.quan quantity
select cprmp300._index1, cprmp300.##i.field##
from cprmp300
where cprmp300._index2 inrange {:i.plnc,:i.plvl,:i.plni,i:chan,59}
and {:i.plnc,:i.plvl,:i.plni,i:chan,65}
order by cprmp300._index2
selectdo
quantity = quantity + cprmp300.##i.field##
endselect
return(quantity)
}
The compiler claims that:
column cprmp300.##field## does not exist.
Does anyone have an idea on how I can solve this?
function extern domain cpcom.quan zsrmp.dll0001.get.master.plan(domain cpcom.plnc i.plnc fixed,
domain cpcom.plvl i.plvl,
domain cpitem i.plni fixed,
domain cpcom.sern i.pern,
domain tcmcs.chan i.chan fixed,
domain ttadv.fdnm i.field)
{
domain cpcom.quan quantity
select cprmp300._index1, cprmp300.##i.field##
from cprmp300
where cprmp300._index2 inrange {:i.plnc,:i.plvl,:i.plni,i:chan,59}
and {:i.plnc,:i.plvl,:i.plni,i:chan,65}
order by cprmp300._index2
selectdo
quantity = quantity + cprmp300.##i.field##
endselect
return(quantity)
}