create Item Journal Line

hhhhhhhqathhhhhhhqat Member Posts: 111
i have one temp table , with the following columns :

Document No. Line No Item No. Barcode Description Quantity cost amount

i want to create one item journal with the same data here , imean to transfer lines to item journal with batch template name ( item) and batch journal name ( transfer ) .

my code is the following , but still i can't see the data thier



IF NOT posted THEN BEGIN
ItemJnlLine.RESET;
ItemJnlLine.SETRANGE("Journal Template Name",'item');
ItemJnlLine.SETRANGE("Journal Batch Name",'WASTAGE');
IF ItemJnlLine.FIND('-') THEN
ItemJnlLine."Line No." := (ItemJnlLine.COUNT + 1) * 10000
ELSE
ItemJnlLine."Line No." := 10000;


tempwlines.RESET;
tempwlines.SETRANGE("Document No.",ItemJnlLine."Document No.");
tempwlines.SETRANGE("Line No",ItemJnlLine."Line No.");

IF tempwlines.FIND('-') THEN REPEAT
ItemJnlLine.INIT;
ItemJnlLine."Journal Template Name" :='item';
ItemJnlLine."Journal Batch Name" :='wastage';
ItemJnlLine."Document No." := "Document No.";
ItemJnlLine."Line No." := tempwlines."Line No";
ItemJnlLine.VALIDATE("Document No.","Document No.");
ItemJnlLine.VALIDATE("Line No.",tempwlines."Line No");
ItemJnlLine.INSERT;
LineNo += 10000;
UNTIL tempwlines.NEXT =0;
MESSAGE('Wastage created in item journal');
posted:=TRUE;
MODIFY;
END
;


any one can help , where's the problem

Comments

  • AndwianAndwian Member Posts: 627
    Are you sure that there is any record in tempwlines?
    Have you look at the Item Journal Line table to see if it there?
    Regards,
    Andwian
  • geronimogeronimo Member Posts: 90
    edited 2010-10-18
    as far as i know journal template name and batch name are code fields so capitalize them in the insert. (also use the lineno correct)

    Do you see the records from the object designer?
  • vijay_gvijay_g Member Posts: 884
    The code you have written looking too confusing try to debug code and see what is exact problem.
  • SavatageSavatage Member Posts: 7,142
    are you saying you just want to copy the lines from one batch to another?

    Did you try copy & Paste? Click the blank box on the top left of the grid to select all - then copy & paste.

    I have a dataport to import Items & Qty's into the item journal. The key is to execute the code in the same order as you would be entering it manually.

    Yours isn't a dataport but here what mine looks like..it should simlar
    OnPreDataItem()
    LineNo := 0;
    DocNoInc := 0;
    
    OnAfterImportRecord()
    DocNoInc := 5335;
    LineNo := LineNo + 10000;
    "Item Journal Line"."Journal Template Name" := 'ITEM';
    "Item Journal Line"."Journal Batch Name" := 'PLUS INS';
    "Item Journal Line".VALIDATE("Posting Date",WORKDATE);
    "Item Journal Line"."Entry Type" := "Item Journal Line"."Entry Type"::"Positive Adjmt.";
    "Item Journal Line".Description := 'DATALOAD';
    "Item Journal Line".VALIDATE("Source Code",'ITEMJNL');
    "Item Journal Line"."Document No." := 'TAG000'+FORMAT(DocNoInc);
    "Item Journal Line"."Line No." := LineNo;
    "Item Journal Line".VALIDATE("Item No.",vItemNo);
    "Item Journal Line".VALIDATE(Quantity,vQuantity);
    "Item Journal Line".VALIDATE("Location Code",'NY');
    

    If you're is a report or something you can throw in a
    If Not Insert Then modify;
  • hhhhhhhqathhhhhhhqat Member Posts: 111
    thanks , it's ok now
Sign In or Register to comment.