Fixed assets are items of value, such as buildings, vehicles, land, and equipment, which are owned by an individual or corporation. You can set up and enter acquisition information for fixed asset records, and then manage fixed assets by depreciating them and setting a capitalization threshold to determine depreciation. You can calculate adjustments to the fixed assets, and also dispose of them.

This post contains code which creates Fixed Assets using X++.

protected AssetId createFixedAsset(str fixedAssetName)

AssetTable assetTable;
AssetBook assetBook;
AssetDepBook assetDepBook;
AssetGroup assetGroup;
AssetDepreciationProfile assetDepProfile;
NumberSeq assetIdNumberSeq;
NumberSequenceTable numberSequenceTable;
NumberSequenceReference numberSequenceReference;

assetGroup = AssetGroup::find(“VEHC”); // Asset group to which Asset will belong

// It is only possible create fixed assets when the number sequence is marked as continuous
select Continuous from numberSequenceTable
join AutoNumberSequenceTable from assetGroup where
assetGroup.GroupId == “VEHC” &&
numberSequenceTable.RecId == assetGroup.AutoNumberSequenceTable;

if (numberSequenceTable.Continuous == NoYes::No)

if (assetGroup.AutoNumberSequenceTable)

throw error(“@SYS116327”);


if (AssetParameters::find().AutoNumber)

numberSequenceReference = AssetParameters::numRefAssetId();
select Continuous from numberSequenceTable where
numberSequenceTable.RecId == numberSequenceReference.NumberSequenceId;

if (numberSequenceTable.Continuous == NoYes::No)

throw error(“@SYS116327”);


throw error(“@SYS122736”);




ttsbegin; //Save asset record.

assetTable.AssetGroup = assetGroup.GroupId; // Assign Asset Group Id

assetTable.AssetType = AssetType::Intangible; // Type of Asset Tangible, InTangible, Financial, GoodWill etc

assetTable.Name = fixedAssetName;                 // Asset Name
assetTable.Quantity = 1;                                   // Quantity of Asset
assetTable.PropertyType = AssetPropertyType::FixedAsset; // Asset property type FixedAsset, ContinuingProperty etc

assetIdNumberSeq = assetTable.initAssetNumberSeq();

if (assetIdNumberSeq)

assetTable.AssetId = assetIdNumberSeq.num();

assetTable.insert(); // Create Fixed Asset

update_recordset assetBook setting Depreciation = NoYes::Yes
where assetBook.AssetId == assetTable.AssetId; // Marking as Depreciating asset

update_recordset assetDepBook setting Depreciation = NoYes::Yes
where assetDepBook.AssetId == assetTable.AssetId; // Marking as Depreciating asset


return assetTable.AssetId;


public static void main(Args _args)

FixedAsset fixAsset;
fixAsset = new FixedAsset();
fixAsset.createFixedAsset(“BMW 525i”);


Leave a Reply

Recent Comments