Monday, 16 September 2013

Dimensions

Dimension are 2 types:

1.default dimension
2.ledger dimension
We will create dimension by 2 types
1.       Through form
2.       Through X++ coding by using classes
Difference between default dimension and ledger dimension:
Default dimension
Ledger dimension
1.       Dimension set storage class
2.       AXDimensionUtilClass::
(getdimension() method)
3.       Ex:   Formate
3008-CostCentre-100
         -Department-Physics
         -Purpose-Others
Here 3008 is vendor or customer
Here we store the dimension in to a unique int64 field i.e DefaultDimension Field.
Ex:62556020(dim value)
We are using the struct class for upadating the dimension combinations
We will take dimensions in to container and run the loop
1.LedgerContract(MainAccount)Class
2.DimensionAttributeContract Class
3.Ex:  Formate
   MainAccount-costCentre-Department-Purpose
         600100-100-physics-others
Here there we create relaton main account with ledger contract

========================================================================
1. Code to get default dimension from the set of dimension values for other than ledger.
static void setDefaultDimensionToCustomer(Args _args)
{
  CustTable custTable;
  Struct struct = new Struct();
  container ledgerDimension;
  DimensionDefault DimensionDefault;
  ;   
  
  struct.add('Abteilung', '02');   
  struct.add('Kostenstellen', '00200');
  ledgerDimension += struct.fields();
  ledgerDimension += struct.fieldName(1);
  ledgerDimension += struct.valueIndex(1);
  ledgerDimension += struct.fieldName(2);
  ledgerDimension += struct.valueIndex(2); 

  ttsBegin;
  DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
  custTable = CustTable::find("22027", true);
  custTable.DefaultDimension = DimensionDefault;
  custTable.update();
  ttsCommit;
}
2. Code to get default dimension from the set of dimension values for Account type ledger.
static void getDimensions(Args _args)
{
    container   myContainer;
   
    myContainer = ["402000-10-55-101010-10-10-100","402000",6,"Location","10","Department", "55","Employee","101010", "BusinessUnit","10","ProfitCenter", "10", "CostCenter","100"];
   
    info(strFmt("%1",AxdDimensionUtil::getLedgerAccountId(myContainer)));
}

No comments:

Post a Comment