CreateICTransaction

Creates an intercompany transaction for a given cell.

Tip:

To test whether a cell is valid for intercompany transactions, use DoesCellSupportICTransactionDetail. To update an existing transaction, use SaveICTransaction.

Syntax

<HsvICM>.CreateICTransaction vbOverwrite, lScenario, lYear, lPeriod, lEntity, lICP, lAccount, lC1, lC2, lC3, lC4, lTRCur, lReason, dTRAmt, dTRLAmt, dTRRate, dTRDate, bstrID, bstrSubID, bstrRefID, bstrComment1, bstrComment2

Argument

Description

vbOverwrite

Boolean (ByVal). A flag that specifies whether to overwrite existing transactions that have the same Transaction ID and Sub ID. Pass TRUE to overwrite, FALSE otherwise.

lScenario

Long (ByVal). The member ID of the transaction’s Scenario dimension member.

lYear

Long (ByVal). The member ID of the transaction’s Year dimension member.

lPeriod

Long (ByVal). The member ID of the transaction’s Period dimension member.

lEntity

Long (ByVal). The member ID of the transaction’s Entity dimension member.

lICP

Long (ByVal). The member ID of the transaction’s Intercompany Partner dimension member.

lAccount

Long (ByVal). The member ID of the transaction’s Account dimension member.

lC1

Long (ByVal). The member ID of the transaction’s Custom 1 dimension member.

lC2

Long (ByVal). The member ID of the transaction’s Custom 2 dimension member.

lC3

Long (ByVal). The member ID of the transaction’s Custom 3 dimension member.

lC4

Long (ByVal). The member ID of the transaction’s Custom 4 dimension member.

lTRCur

Long (ByVal). The ID of the transaction’s currency.

Tip:

You can obtain the ID of an Entity dimension member’s currency with GetEntityCurrencyID. You also can obtain a currency ID with GetTransCurrencyID.

lReason

Long (ByVal). The ID of the transaction’s reason code.

Tip:

You can get a reason code ID with GetICReasonCodeID.

dTRAmt

Double (ByVal). The transaction amount.

dTRLAmt

Double (ByVal). The entity currency amount.

dTRRate

Double (ByVal). The conversion rate.

dTRDate

Double (ByVal). The transaction date formatted as a Double.

bstrID

String (ByVal). The Transaction ID.

bstrSubID

String (ByVal). The transaction’s Sub ID.

bstrRefID

String (ByVal). The transaction’s Reference ID.

bstrComment1

String (ByVal). The first comment for the transaction.

Note:

You can specify a maximum of 256 characters.

bstrComment2

String (ByVal). The second comment for the transaction.

Note:

You can specify a maximum of 256 characters.

Example

The following function creates an intercompany transaction with the current date as the transaction date and the specified entity’s default currency as the transaction currency, and returns whether the specified cell is valid for intercompany transactions. The function uses HsvValues.GetValueIDFromCurrencyID to get the member ID of the Value dimension member that corresponds to the entity’s default currency, and passes this ID to DoesCellSupportICTransactionDetail.

Function createIcTransEntCurrToday(lScen As Long, lYear As Long, lPer _
  As Long, lEnt As Long, lIcp As Long, lAcct As Long, lCust1 As Long, _
  lCust2 As Long, lCust3 As Long, lCust4 As Long, sReason As String, _
  dTranAmt As Double, dEntCurrAmt As Double, sTranId As String, _
  sSubId As String) As Boolean
Dim cICM As HsvICM, lCurr As Long, lReason As Long, bSupport As Boolean
Dim lVal As Long, cValues As HsvValues
'g_cSession is an HsvSession object reference
Set cICM = g_cSession.ICM
lCurr = cICM.GetEntityCurrencyID(lEnt)
'g_cMetadata is an HsvMetadata object reference
Set cValues = g_cMetadata.Values
cValues.GetValueIDFromCurrencyID lCurr, lVal
bSupport = cICM.DoesCellSupportICTransactionDetail(lScen, lYear, lPer, _
  lEnt, lVal, lAcct, lIcp, lCust1, lCust2, lCust3, lCust4)
If bSupport = True Then
  lReason = cICM.GetICReasonCodeID(sReason)
  cICM.CreateICTransaction True, lScen, lYear, lPer, lEnt, lIcp, _
    lAcct, lCust1, lCust2, lCust3, lCust4, lCurr, lReason, dTranAmt, _
    dEntCurrAmt, 0, Now, sTranId, sSubId, "", "", ""
  createIcTransEntCurrToday = True
Else
  createIcTransEntCurrToday = False
End If
End Function