mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 25, 2013 1:59 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Duplicate error
PostPosted: Fri Nov 30, 2012 2:10 pm 
Offline

Joined: Fri Nov 30, 2012 2:03 pm
Posts: 8
Country: Albania (al)
I'm importing from text file in a dataport Purchase invoice header
In the aftergetrecord i wrote:


PurInv.INIT;
PurInv."Document Type" := T38."Document Type"::Invoice;
PurInv.INSERT(TRUE);
PurInv.SetHideValidationDialog(TRUE);
PurInv.VALIDATE("Buy-from Vendor No.",NoVen);
PurInv.VALIDATE("Pay-to Vendor No.",PayVen);
PurInv.MODIFY;

After read first record it execute code but second time show an error: "The Purchase Header Already exists"

Why this? I suspect series number not increment after first record.. :-k


Top
 Profile E-mail  
 
 Post subject: Re: Duplicate error
PostPosted: Fri Nov 30, 2012 4:27 pm 
Offline

Joined: Sat Sep 25, 2004 2:04 am
Posts: 354
Location: Netherlands
Country: Netherlands (nl)
What happens is that the first time your "No." field is empty which will make the Insert(true) statement assign one. But because INIT doesn't initialize primary key fields ( see the help file ), the second time "No." will still be filled, resulting in the code trying to insert the same document. Just empty the "no." field after your INIT, and it should work


Top
 Profile  
 
 Post subject: Re: Duplicate error
PostPosted: Fri Nov 30, 2012 4:32 pm 
Offline

Joined: Fri Nov 30, 2012 2:03 pm
Posts: 8
Country: Albania (al)
Sure! It works.

Thanks


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: BernardJ, Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: