Dataport is created successfully but a slight problem occurs

VesnaVesna Member Posts: 24
Hello colleagues,
I created a dataport in PuchaseLine (39) for importing Vendor invoices.
Inserted Purchase Header lines and created the following Purchase Lines lines:

"Document Type":=PurchaseHeaderRec."Document Type"::Invoice;
"Document No." := NO;
"Line No." := 10000 ;
Type := Type::Item;
"No." := 'XXXX';
Description := 'XXXXXXXX' ;
"Unit of Measure Code" := 'PCS' ;
IF Qty <> 0 THEN
BEGIN
Quantity:=Qty;
END;
"Direct Unit Cost":= UnitCost;
"Line Amount":= Qty*UnitCost;

All required data are imported successfully. I open Invoice card and see quantity, direct unit cost and calculated Line Amount. However, when I click Test Post--Preview, I don't see quantity there as well as Amount is 0. The only data I see there is Direct Unit Cost (actual amount).
Could you tell me where is the error occurs?
Thank you very much

Comments

  • SavatageSavatage Member Posts: 7,142
    personally I would enter the Cost first then validate the quanitiy

    As stated in many posts - you want to enter the data using a dataport usually the same way & in the same order as you would manually enter it on the form.

    And by validating fields like the Item No, Cost & Qty it should fire the code(s) that normally get fired. Such as calculations and the filling of other important fields.

    VALIDATE \:D/
    "Direct Unit Cost":= UnitCost; 
    "Line Amount":= Qty*UnitCost; 
    
    IF Qty <> 0 
      THEN BEGIN
        Quantity:=Qty 
        VALIDATE(Quantity);
     END
       ELSE BEGIN
         CurrDataport.SKIP;
    END;
    

    If done corretly you shouldn't have to calculate the line amount.

    When creating a dataport I always enter 1 line manually & one line thru the dataport and compare them to make sure all the same fields are being filled before I give it the Okey Dokey
Sign In or Register to comment.