Import Problem-urgent

Navi_LearnerNavi_Learner Member Posts: 356
Hi I have a urgent problem. I created a dataport long time ago and we have successfully imported once. But today we tried to import another sales order. It has an error. The following is the error and the code:


/IF "Multiple Ship-to".GET(OrderNo) THEN
IF "Multiple Ship-to".GET(salesheader."No.") THEN
BEGIN
"Multiple Ship-to"."Order No.":=OrderNo;
"Multiple Ship-to"."Sell-To Customer No." := id;
"Multiple Ship-to"."Ship-to Name" :=name;
"Multiple Ship-to"."Line No." := lineno;
"Multiple Ship-to"."Ship-to Contact" :=contact;
"Multiple Ship-to"."Ship-to Address" :=address1;
"Multiple Ship-to"."Ship-to Address 2" :=address2;
"Multiple Ship-to"."Ship-to City" :=city;
"Multiple Ship-to"."Ship-to ZIP Code" := zip;
"Multiple Ship-to"."Ship-to State" :=state;
"Multiple Ship-to"."Ship-to Country Code" :=country;
"Multiple Ship-to"."Shipping Account" :=shippingaccount;
"Multiple Ship-to"."Shipment Method Code" :=methodcode;
"Multiple Ship-to".Notes :=Notes;
"Multiple Ship-to"."Shipping Agent" :=shipagent;

Templine := Templine + 1;
"Multiple Ship-to".INSERT;

Error:

Multiple Ship-to Already Exists, Identification Fields and values Order NO :='' Line No :=10000

Our import file follows the exactly the same order as the dataport fields we created. Please help!!!

Comments

  • idiotidiot Member Posts: 651
    My guess is there is a duplicated lineno somewhere...
    NAV - Norton Anti Virus

    ERP Consultant (not just Navision) & Navision challenger
  • Navi_LearnerNavi_Learner Member Posts: 356
    No, I checked my import Excel Sheet and there is no duplicate 1000. In the line no column, the number is added 10000 thereafter starting from 10000.

    I also tried this. I left the whole column of Line no empty in my import csv file, and then modified my code:

    Multiple Ship-to"."Line No." := lineno +10000;

    The error is: Multiple Ship-to Already Exists, Identification Fields and values Order NO :='' Line No :=0,

    We have 300 records to import and it will be shipped tomorrow. I spent the whole afternoon fixing it, but it didn't work. Appreciate it!
  • AlbertvhAlbertvh Member Posts: 516
    Hi,
    Your problem is that you have blank Order No. in your import file.
    You can also do the following
    instead of
    "Multiple Ship-to".INSERT;
    
    you could do
    IF "Multiple Ship-to".INSERT THEN;
    


    Albert
  • MBergerMBerger Member Posts: 413
    from your line "IF "Multiple Ship-to".GET(salesheader."No.") THEN" i deduce that the primary key of the table is just the "no." field..which means you can only have 1 line per "no."
  • jversusjjversusj Member Posts: 489
    have you watched it fail through debugger? step through the process and watch how your variables and import values are handled.
    kind of fell into this...
  • SavatageSavatage Member Posts: 7,142
    MBerger wrote:
    from your line "IF "Multiple Ship-to".GET(salesheader."No.") THEN" i deduce that the primary key of the table is just the "no." field..which means you can only have 1 line per "no."
    =D> that's what i was thinking :-k
    are you sure line No isn't part of the key too?

    My guess is that this multiple ship to thing is based on each code being differnet like the Ship-To Address Table.

    Is this correct? if so I'm not understanding the Line No thing.

    Should be a Customer No & A Code as the key. Perhaps more info on this table is needed.
Sign In or Register to comment.