Professional Documents
Culture Documents
Microsoft Dynamics GP
Table of Contents
Introduction ................................................................................................ 3
Code and data components ......................................................................... 3
Enabling HITB functionality ........................................................................ 4
Posting data to the HITB table .................................................................... 4
Using Inventory transaction work tables and posting scripts ...................................................... 4
Posting data directly to the Inventory purchase receipts tables .................................................. 4
Using lower-level posting scripts to post transactions to Inventory ............................................. 5
Script API.................................................................................................. 13
ivHITBActivated() ........................................................................................................... 13
ivHITB_Start_TRIGGER .................................................................................................... 13
ivHITB_Finish_TRIGGER .................................................................................................. 13
ivHITBDetail_Reserve_TRIGGER........................................................................................ 13
ivHITBDetail_Add_TRIGGER ............................................................................................. 13
ivHITBDetail_CacheItemValues_TRIGGER ........................................................................... 15
ivHITBDetail_GetCachedItemValues_TRIGGER .................................................................... 15
ivHITBDetail_CacheTrxValues_TRIGGER ............................................................................. 16
ivHITBDetail_GetCachedTrxValues_TRIGGER ...................................................................... 16
ivHITBDetail_CacheTrxLineValues_TRIGGER ....................................................................... 16
ivHITBDetail_GetCachedTrxLineValues_TRIGGER ................................................................. 16
ivHITBDetail_UpdateWithGLPostedValues_TRIGGER ............................................................. 16
2
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Introduction
This article describes how to integrate with the Historical Inventory Trial Balance (HITB) functionality
in Microsoft Dynamics GP 10.0. Specifically, this article details the changes necessary in integrating
applications whose posting logic updates item purchase receipt data in the Inventory module.
For integrating applications that post to Inventory by creating transactions in the Inventory
Transaction Work tables and then use the existing posting routines provided by Microsoft Dynamics GP
(i.e., global procedures IV_Post_Batch or IV_Post_Transaction), no changes are necessary to support
HITB because all necessary changes are embedded within those routines already.
For integrating applications that post directly to the Inventory purchase receipt and transaction history
tables, the appropriate related data must be created in a new table used to track HITB details. If the
correct HITB data is not created, the Historical Inventory Trial Balance Report will not balance with the
corresponding inventory accounts in General Ledger.
HITB dictionary A new dictionary has been added, which includes the HITB code, reports and
data model. This dictionary is named HTB5597.dic and has product ID 5597. This dictionary is
automatically installed with Release 10.0 Service Pack 2.
Inventory Transaction History Detail table A new table has been added in which HITB data
will be stored. This table (SEE30303) is automatically created in each company database when
that company is updated to Release 10.0 Service Pack 2. A detailed data model definition is
included later in this document.
HITB report stored procedure A new stored procedure has been added to collect and
aggregate the data used to print the Historical Inventory Trial Balance Report. This stored
procedure (ivCreateHistoricalIVTrialBalance) is automatically installed in each company database
when that company is updated to Release 10.0 Service Pack 2.
3
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
HITB code and data components are installed. Specifically, the HTB5597.dic file must be installed
and included in the Dynamics.set file. This is done automatically when Release 10.0 Service Pack 2
is installed.
The following row is included in the SY01401 table (in the company database):
USERID = sa, coDefaultType = 5597, USRDFSTR = 1
This row is created automatically when a new company is created in Release 10.0 Service Pack 2.
For existing companies, created prior to installing Release 10.0 Service Pack 2, this row is created
by the HITB Reset Tool provided by Microsoft Dynamics GP Support.
IMPORTANT: This tool must be run on existing companies to create the appropriate beginning
balance data in the SEE30303 table and to ensure that the Inventory sub-ledger and General
Ledger balance properly. If this is not done, the Historical Inventory Trial Balance Report will not
balance with General Ledger.
4
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
2.
3.
When done posting the last line item or the General Ledger black box
array is full:
a.
Note that this call may be made inside the line item posting loop,
depending on how the integrating application posts distributions to
General Ledger for each line item. For example, Microsoft Dynamics GP
code uses an array (of General Ledger distributions) in conjunction
with the General Ledger black box posting routines. That array is
populated within the line item posting loop. When the array is full, the
distributions are posted to General Ledger, so at that point the General
Ledger values need to be applied to the HITB records created up to
that point in time. Thus Microsoft Dynamics GP code calls this script
within the line item posting loop.
5
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Data type
Physical name
Description
Item Number
String 30
ITEMNMBR
Sequence Number
Long Integer
SEQNUMBR
Document Number
String 20
DOCNUMBR
Document Date
Date
DOCDATE
GL Posting Date
Date
GLPOSTDT
Location Code
String 10
LOCNCODE
Receipt Number
String 20
RCPTNMBR
Long Integer
RCTSEQNM
Drop-down
list
PCHSRCTY
6
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Field name
Data type
Physical name
Description
Document Type
Drop-down
List
DOCTYPE
7
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Field name
Data type
Physical name
Description
QTY Type
Drop-down
list
QTYTYPE
U Of M
String 8
UOFM
Currency
TRXQTYInBase
TRX QTY
Currency
TRXQTY
Variance Qty
Currency
VARIANCEQTY
Unit Cost
Currency
UNITCOST
8
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Field name
Data type
Physical name
Description
Extended Cost
Currency
EXTDCOST
Drop-down
list
DECPLQTY
Decimal Places
Currency
Drop-down
list
DECPLCUR
IsOverrideReceipt
Boolean
IsOverrideReceipt
IsOverrideRelieved
Boolean
IsOverrideRelieved
OverrideRelievedDate
Date
OverrideRelievedDate
Originating Revalued
Receipt Number
String 20
ORVRCTNMB
History Module
String 3
HSTMODUL
Originating TRX
Source
String 13
ORTRXSRC
Currency
LNSEQNBR
Long Integer
LNITMSEQ
9
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Field name
Data type
Physical name
Description
Component Sequence
Long Integer
CMPNTSEQ
Source Reference
Number
String 30
SRCRFRNCNMBR
Vendor ID
String 15
VENDORID
PO Number
String 17
PONUMBER
Transaction Reference
Integer
TRXREFERENCE
Valuation Method
Drop-down
list
VCTNMTHD
10
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Field name
Data type
Physical name
Description
IV IV Index
Long integer
IVIVINDX
IV IV Offset Index
Long integer
IVIVOFIX
Journal Entry
Long integer
JRNENTRY
TRX Source
String 13
TRXSORCE
Credit Amount
Currency
CRDTAMNT
Debit Amount
Currency
DEBITAMT
Date
Date
DATE1
Time
Time
TIME1
11
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Key fields
ivHITBDetailIdx_ID
Item Number
Primary, Unique
Document Date
Segment attributes
ascending
GL Posting Date
ascending
Item Number
TRX QTY
Extended Cost
Sequence Number
ivHITBDetailIdx_TrxByDocDate
Unique
Document Date
ascending
Item Number
TRX QTY
Extended Cost
Sequence Number
ivHITBDetailIdx_ItemSequence
Unique
ivHITBDetailIdx_Aggregate
Unique, Clustered
Item Number
Sequence Number
GL Posting Date
ascending
Item Number
QTY Type
Sequence Number
12
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Script API
This section documents the scripts defined in the core Microsoft Dynamics GP dictionary for use in
posting code.
ivHITBActivated()
This global function returns a Boolean value indicating whether the HITB code is loaded and enabled.
See the Enabling HITB functionality section for the conditions that determine whether HITB
functionality is enabled.
Parameters:
(none)
ivHITB_Start_TRIGGER
This global procedure initializes the HITB supporting code and cache data structures. It should be
called at the start of the posting process for a transaction.
Parameters:
(none)
ivHITB_Finish_TRIGGER
This global procedure finalizes the HITB data and moves it from the cache to the SEE30303 table. It
should be called at the end of the posting process for a transaction. Note that if it is not called, the
data will not get added to the SEE30303 table.
Parameters:
fAbort [in] a Boolean value indicating whether the posting process was interrupted or aborted. If
true, the HITB data will be discarded from the cache rather than being transferred to the
SEE30303 table.
ivHITBDetail_Reserve_TRIGGER
This global procedure reserves a record in the HITB data cache and returns the sequence number
assigned to that record. This is helpful if you need to reserve a sequence number early in processing
(before you know the full details of the HITB record), so records added by subsequent processing
appear after the one youve reserved (when sorting or iterating by sequence number).
Parameters:
Item Number [in] The item for which a HITB record will be created in the data cache.
Sequence Number [out] The sequence number reserved for the new record in the data cache.
ivHITBDetail_Add_TRIGGER
This global procedure adds a record to the HITB data cache. Use this whenever a new HITB record
needs to be generated. Note that the ivHITB_Start_TRIGGER script must be called at some point prior
to this in code execution to ensure the data cache is properly initialized.
Also, while this is primarily intended for adding records to the data cache, it can also be use to update
an existing record in the data cache. In order to do use it in this manner, the Item Number and
Sequence Number values must be known for the record you wish to update. Additionally, when used
in this manner, only the values being updated need to be passed into this procedure; those which you
do not wish to change can be passed in as empty values (which will be ignored when updating the
record).
13
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
Note that the following SEE30303 table values are not included as parameters. These are set
internally by the HITB code as follows:
IsOverrideReceipt Set to true if the 'Purchase Receipt Type' parameters value is 4; otherwise, it
is set to false.
Date Set to the date from the SQL Server when the record is saved to the data cache.
Time Set to the time from the SQL Server when the record is saved to the data cache.
Parameters (see the SEE30303 table definition for descriptions of each field):
'Sequence Number' [in] This value should always be zero when adding a new record. If this
script is being called to update an existing HITB record in the data cache, the appropriate
sequence number should be used.
'GL Posting Date' [in] This value is often not yet known at the time the line item is being posted,
so it can be left empty (zero) at this point and updated later.
'Unit Cost' [inout] Note that this value is, in certain cases, altered by Microsoft Dynamics GP
Manufacturing.
'Extended Cost' [inout] Note that this value is, in certain cases, altered by Microsoft Dynamics
GP Manufacturing.
14
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
'Journal Entry' [in] This value is often not yet known at the time the line item is being posted, so
it can be left empty (zero) at this point and updated later.
'TRX Source' [in] This value is sometimes not yet known at the time the line item is being
posted, so it can be left empty at this point and updated later.
'Credit Amount' [inout] Note that this value is, in certain cases, altered by Microsoft Dynamics
GP Manufacturing.
'Debit Amount' [inout] Note that this value is, in certain cases, altered by Microsoft Dynamics GP
Manufacturing.
nTriggerFlag [optional in] An integer used to tell Microsoft Dynamics GP Manufacturing whether
to modify distribution values during posting. To prevent Manufacturing from modifying the
distribution values, exclude or pass 0 to this parameter. In general, though, pass 1 to this
parameter.
ivHITBDetail_CacheItemValues_TRIGGER
This global procedure saves certain item-specific values for later use when adding the HITB record to
the data cache. This is useful when these values are known only outside of the scope of the code that
adds the HITB records to the data cache. These values can later be retrieved using global procedure
ivHITBDetail_GetCachedItemValues_TRIGGER.
Values cached by this procedure are:
Item Number
Valuation Method
Parameters:
table IV_Item_MSTR [in] The item master table buffer, positioned on the item record for which
you wish to cache the values.
ivHITBDetail_GetCachedItemValues_TRIGGER
This global procedure returns the values cached by the ivHITBDetail_CacheItemValues_TRIGGER
procedure.
Parameters:
Item Number [inout] This value is provided mainly to validate that the cached values are for
the desired item number.
'Valuation Method' [out] The valuation method cached for the item.
15
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
ivHITBDetail_CacheTrxValues_TRIGGER
This global procedure saves certain values (which are generally stored with the transaction header
information) for later use when adding the HITB record to the data cache. This is useful when these
values are known only outside of the scope of the code which adds the HITB records to the data
cache. These values can later be retrieved using global procedure
ivHITBDetail_GetCachedTrxValues_TRIGGER.
Parameters:
ivHITBDetail_GetCachedTrxValues_TRIGGER
This global procedure returns the values cached by the ivHITBDetail_CacheTrxValues_TRIGGER
procedure.
Parameters:
ivHITBDetail_CacheTrxLineValues_TRIGGER
This global procedure saves certain values (which are generally stored with the transaction line item
information) for later use when adding the HITB record to the data cache. This is useful when these
values are known only outside of the scope of the code that adds the HITB records to the data cache.
These values can later be retrieved using global procedure
ivHITBDetail_GetCachedTrxLineValues_TRIGGER.
Parameters:
ivHITBDetail_GetCachedTrxLineValues_TRIGGER
This global procedure returns the values cached by the ivHITBDetail_CacheTrxLineValues_TRIGGER
procedure.
Parameters:
ivHITBDetail_UpdateWithGLPostedValues_TRIGGER
This global procedure updates any records in the HITB data cache (which have not already been
assigned GL posting values) with the specified posting date, journal entry number and (optionally)
transaction source (batch ID). This is useful when many line items are posted before the related GL
16
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE
distributions get posted (so there are records in the data cache without GL transaction information
assigned to them).
Parameters:
'GL Posting Date' [in] The date on which the distributions were posted to GL.
'Journal Entry' [in] The Journal Entry Number to which the GL distributions have been assigned.
'TRX Source' [optional in] The transaction source to which the journal entry is assigned in GL.
Microsoft Dynamics is a line of integrated, adaptable business management solutions that enables you and your
people to make business decisions with greater confidence. Microsoft Dynamics works like and with familiar
Microsoft software, automating and streamlining financial, customer relationship and supply chain processes in a
way that helps you drive business success.
U.S. and Canada Toll Free 1-888-477-7989
Worldwide +1-701-281-6500
0Hwww.microsoft.com/dynamics
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the
date of publication. Because Microsoft must respond to changing market conditions, this document should not be interpreted to be a
commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of
publication.
This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS
TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of
this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means
(electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of
Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject
matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this
document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.
2008 Microsoft Corporation. All rights reserved.
Microsoft, the Microsoft Dynamics Logo, Microsoft Dynamics, and SQL Server are either registered trademarks or trademarks of
Microsoft Corporation in the United States and/or other countries.
17
INTEGRATING WITH THE HISTORICAL INVENTORY TRIAL BALANCE