purchase line/header form

surisuri Member Posts: 123
Q : report which will create 100 purchase orders, 100 sales orders for same vendor and same item for testing
hi good morning one and all
the above shown is my question
i have tried as shown below

i have taken dataitem
purchase header

global variables as
purchase line as record type
linecount of integer type

in on afterget record i have written the code

pline.RESET;
linecount :=0;
pline.INIT;
IF NOT pline.FINDLAST THEN
pline."Line No." :=linecount+1
ELSE
pline."Line No." :=pline.Type::Item;
pline."Document Type" :="Purchase Header"."Document Type";
pline.INSERT;

it was throwing an error
can you suggest me the code
thank you

Comments

  • SavatageSavatage Member Posts: 7,142
    pline."Line No." :=pline.Type::Item;

    :?: :?: :?:
  • surisuri Member Posts: 123
    thanks for the reply
    again i am getting the same error

    can you suggest how can i solve this problem
  • Yashojit_PandhareYashojit_Pandhare Member Posts: 38
    i could not see your linecount incrementing

    pline."Line No." :=linecount+1

    instead add

    linecount:=linecount+1;
    pline."Line No." := linecount;
  • surisuri Member Posts: 123
    thanks for giving reply sir
    what you have suggested i have done
    now my code is like this as shown below ...even though i am getting the same error

    pline.RESET;
    linecount :=0;
    pline.INIT;
    IF NOT pline.FINDLAST THEN
    BEGIN
    linecount:=linecount+1;
    pline."Line No." := linecount;
    END
    ELSE
    //pline."Line No." :=pline.Type::Item;
    pline."Document Type" :="Purchase Header"."Document Type";
    pline.INSERT;
  • SavatageSavatage Member Posts: 7,142
    read through your code and follow what;s happening.

    if it doesn't find a line you are making the line #1
    if it does find a line where are you setting the next line #?

    plus without an end; at the bottom don't you run into a compiling error?

    as well as end else? end else begin should bw the code
    http://msdn.microsoft.com/en-us/library/dd338872.aspx
Sign In or Register to comment.