Problems with Sales Invoice Header,Line

Helo! I made a simple report to change an Invoice document number. … IF “Document No.” = ‘PR4-0062’ THEN BEGIN “Document No.”:=‘PR4-00062’; MODIFY; END; This really simple piece of code worked perfectly in table like “Service Ledger Entry” or “G/L Entry”, however the damn thing won’t work for “Salse invoice Header” and “Sales invoice Line”. If i run the report i allways get an error message saying that It could’d find a record with that specific document number in a specified line… If anyone knows why this is happening, please help… Thanx in advance, lp prosen

That’s because for those 2 tables (112 and 113) the Document No. is part of the primary key. In these cases you must use RENAME to change the contents of the fields. You must however be very, very careful with what you are trying to achieve. It will be very easy to make a mistake or forget about a table, therefore losing the relationship between records.

I suspected it had something to do with primary keys … How do i use this RENAME. I looked it up c/side reference guide but there’s no example …

Hi You should find and filter single record and the rename it. In your case this should do the job: SalesHeader.SetCurrentkey(SalesHeader.Type,SalesHeader."No."); SalesHeader.SetRange(SalesHeader."Document No.",'PR4-0062' ); If SalesHeader.Find('-') Then SalesHeader.Rename(YourType,'PR4-00062'); YourType = your old SalesHeader.Type You have to put it in also! Please be careful as Nelson already mentioned! bye André

Prosen, Please also remember the audit consequences that may arise. The revenue and VAT and auditors may ask you to prove what happened to that ‘missing’ invoice and why and when it might happen again! Small stuff for the system but big implications for the business

Thanks for all the help and warrnings. I plan to test this thoroughly before i use it on our production base …