mibuso.com

Microsoft Business Solutions online community
It is currently Tue May 21, 2013 10:25 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Solved] Salesheader table creates a blank no.
PostPosted: Tue Mar 12, 2013 1:34 pm 
Offline

Joined: Tue Mar 12, 2013 1:27 pm
Posts: 5
Country: Denmark (dk)
Im trying to import invoices to salesheader table. If i import one invoice it works fine, but if i import multiple invoices then i get this error: "The Sales Header already exists. Identification fields and values: Document type='Invoice,No=''

Here is the code

IF fl.FINDFIRST THEN
REPEAT
MySalesHeader.INIT;
MySalesHeader."Posting Date" := TODAY;
MySalesHeader."Document Date" := TODAY;
MySalesHeader."Document Type" := MySalesHeader."Document Type"::Invoice;
MySalesHeader.VALIDATE("Sell-to Customer No.", fl.debet);
MySalesHeader.INSERT;
UNTIL fl.NEXT = 0;

fl is the table with the imported invoices

Any idea what is wrong here?

Thank you in advance :)


Top
 Profile E-mail  
 
 Post subject: Re: Salesheader table creates a blank no.
PostPosted: Tue Mar 12, 2013 1:47 pm 
Offline

Joined: Thu Aug 12, 2010 1:45 pm
Posts: 77
Location: Mumbai
Country: India (in)
bianconeri wrote:

IF fl.FINDFIRST THEN
REPEAT
MySalesHeader.INIT;
MySalesHeader."Posting Date" := TODAY;
MySalesHeader."Document Date" := TODAY;
MySalesHeader."Document Type" := MySalesHeader."Document Type"::Invoice;
MySalesHeader.VALIDATE("Sell-to Customer No.", fl.debet);
MySalesHeader.INSERT;
UNTIL fl.NEXT = 0;


You are not assigning any value to "No."


Top
 Profile E-mail  
 
 Post subject: Re: Salesheader table creates a blank no.
PostPosted: Tue Mar 12, 2013 1:53 pm 
Offline

Joined: Fri Mar 14, 2003 9:18 am
Posts: 475
Location: Johannesburg
Country: South Africa (za)
Try this

Code: Select all
CLEAR(MySalesHeader);


before the INIT statement or MySalesHeader."No." := '';

Hope this helps


Top
 Profile  
 
 Post subject: Re: Salesheader table creates a blank no.
PostPosted: Tue Mar 12, 2013 1:54 pm 
Offline

Joined: Tue Mar 12, 2013 1:27 pm
Posts: 5
Country: Denmark (dk)
When Sales header initializes No. is automatically assigned.. increment by 1


Top
 Profile E-mail  
 
 Post subject: Re: Salesheader table creates a blank no.
PostPosted: Tue Mar 12, 2013 2:04 pm 
Offline

Joined: Tue Mar 12, 2013 1:27 pm
Posts: 5
Country: Denmark (dk)
I have tried CLEAR(MySalesHeader) and MySalesHeader."No." := ''

But I keep getting the same error.. Sales Header already exists.


Top
 Profile E-mail  
 
 Post subject: Re: Salesheader table creates a blank no.
PostPosted: Tue Mar 12, 2013 2:54 pm 
Offline

Joined: Tue Mar 12, 2013 1:27 pm
Posts: 5
Country: Denmark (dk)
Solved :)

Instead of typing insert I typed insert(true)

Thank for your help


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 11 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: