becks22
11th August 2010, 19:26
Hi All,
I have a problem ..I have developed a new maintain Session ..in the order field of that session I am first inserting the series number and then after clicking on the save the order number should get generated ..How can I achieve that ?? Shall I use AFS or any thing else

bdittmar
11th August 2010, 20:01
Hi All,
I have a problem ..I have developed a new maintain Session ..in the order field of that session I am first inserting the series number and then after clicking on the save the order number should get generated ..How can I achieve that ?? Shall I use AFS or any thing else

Hello,

you can do it like first free order numbers in B4 standard is handled.

Create a second table for order numbers.
By save, read the last order number in the above table and increment by 1.
save this order number in the table and use it in your session/table.

Regards

rp.chowdary
24th August 2010, 10:02
field.tdsel017.pono:
before.input:
tdsel017.pono = next.sr.number()


functions:

function domain tcsrnb next.sr.number()
{
last.srno = 0
search.last.used.sr.number.in.table()
search.last.used.sr.number.on.screen()
if last.srno > 98 then
return(0)
endif
return(last.srno + 10)

}

function search.last.used.sr.number.in.table()
{
select tdsel017.gpno, tdsel017.pono:last.srno
from tdsel017
where tdsel017._index1 = {:tdsel017.gpno,:tdsel017.pono}
order by tdsel017._index1 desc
as set with 1 rows
selectdo
endselect
}

function search.last.used.sr.number.on.screen()
{
| domain tcacoc occ.no | occurrence number
domain tcpono occ.no

for occ.no = 1 to (filled.occ - 1)
do.occ.without.update(occ.no,check.last.used.sr.number)
endfor
}

function check.last.used.sr.number()
{
last.srno = max(tdsel017.pono,last.srno)

}



tdsel017.pono is a seq field.

try this one..