create Item Journal Line

hhhhhhhqat
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
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
0
Comments
-
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?0 -
The code you have written looking too confusing try to debug code and see what is exact problem.0
-
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 simlarOnPreDataItem() 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;0 -
thanks , it's ok now0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions