would anyone be so kind as to give me a clue how can i print on the invoice report for each line on the posted invoice the serial no. of the items listed...
yes that might be part of the solution.. but how do i implement the fact that for each line in the invoice there might be more than 1 serial no. depending on the quantity of each item.. that's where my biggest problem is... :idea:
You will need to look at how the "Posted Sales Invoices" displays the serial Numbers.
This worked for me.
You will a need Temporary Table Variable TempItemLedgerEntry.
And use code similar to this on the OnAfterGetRecord trigger of "Sales Invoice Line"
TempItemLedgEntry.DELETEALL;
IF Type = Type::Item THEN
MyCodeUnit.GetPostedItemTracking(
"Sales Invoice Line".RowID1,TempItemLedgEntry);
code from MyCodeUnit.
GetPostedItemTracking(InvoiceRowID : Text[100];VAR TempItemLedgEntry : TEMPORARY Record "Item Ledger Entry")
// Used when calling Item Tracking from invoiced documents:
ValueEntryRelation.SETCURRENTKEY("Source RowId");
ValueEntryRelation.SETRANGE("Source RowId",InvoiceRowID);
IF ValueEntryRelation.FIND('-') THEN
REPEAT
ValueEntry.GET(ValueEntryRelation."Value Entry No.");
ItemLedgEntry.GET(ValueEntry."Item Ledger Entry No.");
TempItemLedgEntry.RESET;
TempItemLedgEntry.SETRANGE("Serial No.",ItemLedgEntry."Serial No.");
TempItemLedgEntry.SETRANGE("Lot No.",ItemLedgEntry."Lot No.");
IF NOT TempItemLedgEntry.FIND('-') THEN BEGIN
TempItemLedgEntry := ItemLedgEntry;
TempItemLedgEntry.INSERT;
END;
UNTIL ValueEntryRelation.NEXT = 0;
Then you will need a new Dataitem of Integer(Name ItemTrackingLoop) Indented after "Sales Invoice Line".
OnPreDataItem of ItemTrackingLoop code like this
TempItemLedgEntry.RESET;
IF TempItemLedgEntry.COUNT = 0 THEN
CurrReport.BREAK;
SETRANGE(Number,1,TempItemLedgEntry.COUNT);
OnAfterGetRecord of ItemTrackingLoop code like this
IF Number = 1 THEN
TempItemLedgEntry.FIND('-')
ELSE
IF TempItemLedgEntry.NEXT = 0 THEN
CurrReport.BREAK;
thank you Stephen, i tryed your ideea, i declared all the variables and i've written the neccesary code but when i try to run the report i get an error message saying that i don't have the permission to modify Item Ledger Entry table. if you're wondering if i declared a temporary table, yes i did. the only think that differs from your ideea is that i implemented all the code in the report's design because it seems that i don't have the permission to create a new codeunit. and in the section of the newly created integer data item i created a text box to display the serial no.
what do you suppose i did wrong? i really can't figure it out.
i've even succeded in writing that codeunit (the problem was, i was picking only forbiden id's for my codeunit :roll: ).. the same error apears when i run the report..
In the Codeunit you can set the Permissions property for Table 32 "Item Ledger Entry". Leave all options ticked.
If in doubt look at the permissions property in Code Unit 80 "Sales Post".
i've just tryed what you said with the permissions and when i complie de codeunit the same error appears, saying that i don't have the permission to write in the ledger entry table...
What type of license are you using. To create developments that modify, Insert etc.. Protected tables ie "Item Ledger Entry" you will need a "Solution Developer License".
To get round this problem, yuo can use any table with a Code 20 Primary key (eg Item, Customer etc...) declared as Temporary.
GetPostedItemTracking(InvoiceRowID : Text[100];VAR TempItem : TEMPORARY Record Item)
// Used when calling Item Tracking from invoiced documents:
ValueEntryRelation.SETCURRENTKEY("Source RowId");
ValueEntryRelation.SETRANGE("Source RowId",InvoiceRowID);
IF ValueEntryRelation.FIND('-') THEN
REPEAT
ValueEntry.GET(ValueEntryRelation."Value Entry No.");
ItemLedgEntry.GET(ValueEntry."Item Ledger Entry No.");
IF NOT TempItem.GET(ItemLedgEntry."Serial No.") THEN BEGIN
TempItem."No." := ItemLedgEntry."Serial No.";
TempItem.INSERT;
END;
UNTIL ValueEntryRelation.NEXT = 0;
I am guessing that the all the "Serial No." will be Unique.
Just remember to Change the temp table in the Report as well.
This has not been tested but it should help you in the right direction.
yes.. i tried it at home and it works, i hope the second version will work at the company i'm working with. indeed i'm using a training liscence but it's the same one i use at home..
but now i have another problem at work.. when i try to post a sales invoice i get the following error
"Reference to member CheckCOGSDimValuePost of the variable could not be solved" - this is the exact message, i haven't omitted anything..
i don't know what causes it..
Comments
pointing to table "Value Entry Relation"
then add some code on triggers on the new item:
"Value Entry Relation".OnPreDataItem()
SETRANGE("Source RowId","Sales Invoice Line".RowID1);
Value Entry Relation - OnAfterGetRecord()
ValueEntry.GET("Value Entry No.");
ItemLedgEntry.GET(ValueEntry."Item Ledger Entry No.");
... and take the Seial and Lot No. form ItemLedgerEntry Record
where avriables are:
ValueEntry : Record Table 5802
ItemLedgerEntry : Record Table 32
hope it helps..
thanks again
Mada.
This worked for me.
You will a need Temporary Table Variable TempItemLedgerEntry.
And use code similar to this on the OnAfterGetRecord trigger of "Sales Invoice Line"
Then you will need a new Dataitem of Integer(Name ItemTrackingLoop) Indented after "Sales Invoice Line".
what do you suppose i did wrong? i really can't figure it out.
thanks a million.
Mada.
In the Codeunit you can set the Permissions property for Table 32 "Item Ledger Entry". Leave all options ticked.
If in doubt look at the permissions property in Code Unit 80 "Sales Post".
i've just tryed what you said with the permissions and when i complie de codeunit the same error appears, saying that i don't have the permission to write in the ledger entry table...
Mada.
What type of license are you using. To create developments that modify, Insert etc.. Protected tables ie "Item Ledger Entry" you will need a "Solution Developer License".
To get round this problem, yuo can use any table with a Code 20 Primary key (eg Item, Customer etc...) declared as Temporary.
I am guessing that the all the "Serial No." will be Unique.
Just remember to Change the temp table in the Report as well.
This has not been tested but it should help you in the right direction.
but now i have another problem at work.. when i try to post a sales invoice i get the following error
"Reference to member CheckCOGSDimValuePost of the variable could not be solved" - this is the exact message, i haven't omitted anything..
i don't know what causes it..
what do you think..?
Mada.
just wanted to let you know that the sales invoice works just fine, thanks to you...
thanks again for your help...
Mada.