layswan
9th January 2014, 09:45
Hi,

I use the function as shown as below to autogenerate the order number:

tcmcs.dll0050.check.and.generate.order.number(3, seri.num, "X01", 9, ord.no)

From the above function,the 2nd argument is series number which is S02 and the 4th argument mean max length of the orde number which is 9 and the result of the order number I get is S0200000 (total length is 8, the result should be S02000001)

If I change te 4th argument to 8 then the result become S0200001 (total length is 8 too)

Anyone have any idea why the result come out with total length is 8 even I already mentioned 9 as the max length?:confused:

bhushanchanda
9th January 2014, 11:39
Hi,

Here is the example of how it works:-

extern domain tcorno orno

orno = "NOR"
err = tcmcs.dll0050.check.and.generate.order.number(3,orno,"121",9,"")


1st Argument :- Action
2nd Argument (orno):- It will have the order number once the DLL is executed. Pass your order series here.
3rd Argument ("121") :- Number Group for Order e.g. Sales Order (Session:-tcmcs0150m000 )
4th Argument(9) :- To be passed when 5th Argument is blank.
5th Argument:- Field for which the order number is generated. If this is passed, the length can be kept as 0.


Check your domain for the field seri.num. If parameters are incorrect, system will generate an error -12.

layswan
10th January 2014, 03:50
Hi,

Thanks for the reply, it is working according to yur advice.

Thanks! ;)

layswan
10th January 2014, 05:23
Hi,

I am facing another problem for the above function that is when i click save it prompted me an error message as show in the attached file.

Anyone have any idea to solve it?


Thanks!

bhushanchanda
10th January 2014, 06:19
Hi,

It means there's some programming error. Post your code if possible.

Try putting your code in after.update.db.commit: section. Check under debugger where the problem is exactly caused.

sgoupil
14th January 2014, 20:16
Hi, we had the same problem, but in Baan4c4. After calling your dll function, in your code, add a commit.transaction() (not sur if this still exist in ERP LN). It solved our issue.

layswan
21st January 2014, 08:26
Hey,

I aldready put the dll function under after.update.db.commit and also put in the commit.transaction() after the dll function but still got the same problem.
Below is the program code of mine:

after.update.db.commit:

count = 0
long ret

update.occ()

seri.num = txswn050.orno
tcmcs.dll0050.check.and.generate.order.number(3, seri.num, num.grp, 9, "")

txswn050.orno = seri.num

select txswn050.orno
from txswn050 for update
where txswn050._index1 = :txswn050.orno
selectdo
dal.change.object("txswn050")
dal.set.field("txswn050.orno", seri.num )
ret = dal.save.object("txswn050")
commit.transaction()

if ret = 0 then
count = count + 1
endif
endselect


Any advice???