Some of our customers are using Intercompany Posting.  This is a useful tool but I have needed to make several changes to the code to make sure that the customer gets the functionality that is needed.  For example we are using separate IC Partner codes for each Responsibility Center within a single company.

One thing though I would like Microsoft to fix in Codeunit 80.  There the Intercompany Posting code is executed after a COMMIT.  I suggest a small change.

[code]
IF NOT WhseRqst.ISEMPTY THEN
WhseRqst.DELETEALL;
END;

//#IC-
IF Invoice AND ("Bill-to IC Partner Code" <> ”) THEN
IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice] THEN
ICInOutBoxMgt.CreateOutboxSalesInvTrans(SalesInvHeader)
ELSE
ICInOutBoxMgt.CreateOutboxSalesCrMemoTrans(SalesCrMemoHeader);
//#IC+

InsertValueEntryRelation;
IF NOT InvtPickPutaway THEN
COMMIT;
CLEAR(WhsePostRcpt);
CLEAR(WhsePostShpt);
CLEAR(GenJnlPostLine);
CLEAR(ResJnlPostLine);
CLEAR(JobPostLine);
CLEAR(ItemJnlPostLine);
CLEAR(WhseJnlPostLine);
CLEAR(InvtAdjmt);
Window.CLOSE;
//#IC-
// IF Invoice AND ("Bill-to IC Partner Code" <> ”) THEN
// IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice] THEN
// ICInOutBoxMgt.CreateOutboxSalesInvTrans(SalesInvHeader)
// ELSE
// ICInOutBoxMgt.CreateOutboxSalesCrMemoTrans(SalesCrMemoHeader);
//#IC+
END;[/code]

There is also another coding method in Codeunit 427 that I would like Microsoft to change.

[code]

CreateOutboxJnlTransaction(TempGenJnlLine : TEMPORARY Record "Gen. Journal Line";Rejection : Boolean) : Integer
ICPartner.GET(TempGenJnlLine."IC Partner Code");
IF ICPartner."Inbox Type" = ICPartner."Inbox Type"::"No IC Transfer" THEN
EXIT(0);

GLSetup.LOCKTABLE;
GetGLSetup;
IF GLSetup."Last IC Transaction No." < 0 THEN
GLSetup."Last IC Transaction No." := 0;
ICTransactionNo := GLSetup."Last IC Transaction No." + 1;
GLSetup."Last IC Transaction No." := ICTransactionNo;
GLSetup.MODIFY;
[/code]

I don’t like to use the General Ledger Setup table to store the last transaction number.

2 thoughts on “Intercompany Transaction from Sales Posting

  1. Ratnesh Shukla says:

    Thanks for posting it, this is really usefull but I would like to know that is the same code is for NAV 2013R2 also.

  2. Hi Ratnesh

    I have added a lot of changes to the Intercompany Posting in NAV 2013 R2. For example the ability to add a posted invoice to the outbox. In the companies that I use this functionality for only posted documents are used. Therefore I have enabled an IC Partner modification on Customers and Vendors if I only support posted documents. I have also created a web service and a web service client that enables me to send from one outbox to an inbox on the other end of a web service.

    Also addes support for E-Invoices and created a mapping functionality for incoming invoices to make sure that purchase invoices are correctly created.

Leave a Reply

%d bloggers like this: