Passing Job No Through to Customer Ledger Entry table in Nav 5.2

Hi Forum, I need to pass the Job No. thru to the Customer Ledger Entry table. I have added Job No to the CLE Table and added a line to CodeUnit 12 but it does not appear. Am I missing a step. This data is being passed via a Sales Credit Memo that was generated from a Planning Line in a Job. Many thanks Paul

Hi Paul,

Well that’s the way to do it. So my guess that you’ve added this extra line in the wrong place. Can you check if the corresponding G/L Entry line holds the Job No.?

Hi Erik, the corresponding GL Entry does have the Job Number on it. I added and extra line to CU12 in amongst all the other lines in PostCust(), see below

CustLedgEntry.“Reason Code” := “Reason Code”;
CustLedgEntry.“Job No.” := “Job No.”; //PPJC
CustLedgEntry.“Entry No.” := NextEntryNo;

Is this the wrong place.


That’s exactly where I would have put it.

Have you tried using the debugger to see what happens?


When the credit memo is posted, it’s done through CU 80.
CU 80 creates G/L Journal Lines, and then calls CU12 to post them.

My guess is that you have to look at CU 80.
In the OnRun-trigger look for…
// Post customer entry
This is where the G/L Journal Line is created that ends up creating the CLE.

OK… maybe i should have read the thread more carefully…
Since the Job No. is in the GLE that corresponds to the CLE, you already had modified CU 80.

Hi Erik,

I tried the debugger and it looked fine but just towards the end it was gone. I will run it againb with the debugger on and pay even closer attention. Paul

That’s standard functionality.

OK… Didn’t know that.
In my clean CRONUS-DB (5.0 & 6.0) i see no Job No. being put in the GenJnlLine when posting the Customer Entry in CU 80.

Hi Alexander, this is my point. I have looked thru CU80 and tried to find the correct place to move Job No to the Gen Jnl Line. There is a function FillInvPostingBuffer that does move the Job No from Sales Line to GenJnlLine but even that doesnt seem to do the trick. I am lost as to where to add extra code. Paul

Hi Paul,

I think you have missed a very importent thing here…
The lines of the Sales Document are NOT used to create the CLE (by default).
This is created using the header of the Sales Document.

What happens in CU80 (amongst a lot of other things) is that the lines are looped, and put into the Posting Buffer.
Then the PostingBuffer is looped, and General Journal Lines are created (and posted) from these.
(so far we have no CLE)
Then the General Journal Line is created (and posted), that will eventually become the CLE.
If you search for the exact term…
// Post Customer Entry
You’ll find where that happens.
In this section you have to put the Job No. in the General Journal Line.
Then your modification to CU12 will make the Job No. present in CLE.

There is no Job No. field in table 36 - Sales Header, and because a sales document can contain more than 1 line, wich theoretically can contain different Job No.'s you’ll have to handle that too.

Hi Alexander, thanks for that, I will have another look at CU 80 later and let you know how I get on. Many thanks Paul

Hi Alexander, I added a line top move Job No. to the GenJnlLine within the place you suggested, the CU would not compile as it believed Job No. to be an undefined variable.

Code was GenJnlLine.“Job No.” := “Job No.”;


Hi Alexander, I added the following line in the place you suggested…

GenJnlLine.“Job No.” := InvPostingBuffer[1].“Job No.”;

Amended CU 11 to remove the TESTFIELD for Job No. equal to blank and it works. The CLE entry now has the Job Number. It doesn’t look to have caused any problems but I will test some more. Paul

Hi Paul,


Just remember that any given sales credit memo or invoice can touch more than 1 job, however it’ll always create only 1 CLE.
Since you take the job no. from the InvPostingBuffer, you’ll end up using the last job no. posted to, when the lines were posted.

You might want to consider if it’s better to implement some check that only 1 job is touched by the lines, but that will remove the possibility to invoice all jobs to same customer in one invoice.

Remember that CU 80 is used every time a sales document is posted, from everywhere in the application. Not just when creating credit memo on a planning line.

Hi Alexander, no worries there because the Sales Credits or Sales Invoices come from Jobs but thanks for the cautionary advice. Paul