100 purchase orders

surisuri Member Posts: 123
report which will create 100 purchase orders, 100 sales orders for same vendor and same item for testing

i have taken two data items
purchase header
purchase line
i have written the code in onaftergetrecord()

IF "Purchase Header".FINDLAST THEN
FOR i :=1 TO 5 DO
BEGIN
"Purchase Line".INIT;
"Purchase Header"."Document Type" :="Purchase Header"."Document Type"::Invoice;
"Purchase Header"."No.":="Purchase Line"."No.";
"Purchase Header"."No.":='55555';
"Purchase Line".INSERT;

END

it was throwing an error
purchase line already exists identification fields and values
can any one suggest me some idea.regarding this
thank you

Comments

  • surisuri Member Posts: 123
    hi all...the below code was inserting one no that is 5899..
    IF "Purchase Header".FINDLAST THEN
    "Purchase Header".INIT;
    "Purchase Header"."Document Type" :="Purchase Header"."Document Type"::Invoice;
    "Purchase Header"."No.":='5899';
    MESSAGE('%1',"Purchase Header"."No.");
    "Purchase Header".INSERT
    END

    coming to this code it was trowing an error already exists
    IF "Purchase Header".FINDLAST THEN
    FOR i :=1 TO 5 DO
    BEGIN
    "Purchase Header".INIT;
    "Purchase Header"."Document Type" :="Purchase Header"."Document Type"::Invoice;
    "Purchase Header"."No.":='5899';
    MESSAGE('%1',"Purchase Header"."No.");
    "Purchase Header".INSERT

    END
  • surisuri Member Posts: 123
    ok i understand document type and no both are primary keys thats why it was throwing an error
    but how can i 100 lines with same item
    can any one give me suggestion
  • surisuri Member Posts: 123
    ok one and all,i got by this code

    i have taken two data items
    purchase header,purchase line
    code unit=noseriemanagement
    record=purchase & payable setup

    and i have return this code in onafter get record()

    Pursetup.GET;
    IF "Purchase Header".FINDLAST THEN
    FOR i :=1 TO 5 DO
    BEGIN
    "Purchase Header".INIT;
    pheader."No.":=nomgmt.GetNextNo(Pursetup."Order Nos.",0D,TRUE);
    pheader."Buy-from Vendor No.":='1255';
    pheader.INSERT;

    END
    thank you.....
  • AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
    [Topic closed because of Double Posting: viewtopic.php?f=23&t=56989]
This discussion has been closed.