Importing Vendors invoices through dataport

VesnaVesna Member Posts: 24
Good day everyone,
I am creating a dataport for importing Vendors invoces.
As I realized it is better to do through importing (38)Purchase Header and (39)Purchase Line. Since our client has only one product to sell Purchase Line information is always the same which is:
Document Type - Invoice
Line No. - 10000
Type - Item
No. - CE
Description - CE
Quantity -1
I believe I can create one dataport through Purchase Header and assign through C/AL code Purhcase Line functions to it.
Unfortunately all functions I tryed so far failed. Can you advise me anything? How can I created required dataport.
Thank you
Vesna

Comments

  • gulamdastagirgulamdastagir Member Posts: 411
    create a dataport for purchase line and

    onpredataport tigger
                   PH."Document Type":=PH."Document Type"::Order;
                   LN:= NS.GetNextNo('INV-NUM',0D,TRUE) ;
                   PH.VALIDATE("No.",LN);
                   PH.INSERT(TRUE);
                   PH.VALIDATE(PH."Buy-from Vendor No.",ven);
                   PH.VALIDATE(PH."Shortcut Dimension 1 Code",cc);
                   PH.VALIDATE(PH."Receiving No.",RN) ;
                   PH.VALIDATE(PH."Vendor Invoice No.",VIN);
                   PH.MODIFY(TRUE);
    

    here PH is Purchase header record

    enjoy!its ur lucky day
    Regards,

    GD
  • bbrownbbrown Member Posts: 3,268
    Another approach I've used in the past is to use a dataport to load the requisition worksheet, then generate and post the purchase orders.
    There are no bugs - only undocumented features.
  • MbadMbad Member Posts: 344
    Just remember to not hardcode anything
  • VesnaVesna Member Posts: 24
    Thanks
    There is a way how I did it.
    Myabe for some one it would be useful too.


    PurchaseHeaderRec.INIT;
    PurchaseHeaderRec."Document Type":=PurchaseHeaderRec."Document Type"::Invoice;
    PurchaseHeaderRec.VALIDATE("No.", NO);
    PurchaseHeaderRec.VALIDATE("Buy-from Vendor No.", VEN);
    PurchaseHeaderRec.VALIDATE("Vendor Invoice No.", VIN);
    PurchaseHeaderRec.INSERT(TRUE);
Sign In or Register to comment.