Default dimension

Here is the sample Job to insert Default Dimension,It is just a sample job according to my client requirements, sharing just for an idea, it insert Business unit according to hardcoded p&l,

i used AxdDimensionUtil class for this purpose

 

// BU and vales are hardcoded as per requirments for INTECH

static void AXPsetFinancialDimensionToCustomer()
{
CustTable custTable;
container ledgerDimension;
DimensionDefault dimensionDefault;
int i, centerNum;
str centerValue, businessUnitValue, businessUnitValueParmeter;

// custTable = CustTable::find(‘10183’,true);
while select forUpdate custTable
{
businessUnitValueParmeter = ‘00000424’; // Only This Business Unit will Insert/Update
if(custTable.RecId)
{
ledgerDimension = AxdDimensionUtil::getDimensionAttributeValueSetValue(custTable.DefaultDimension);
i = conFind(ledgerDimension, “BusinessUnit”);
centerNum = conFind(ledgerDimension, “Center”);
centerValue = conPeek(ledgerDimension , (centerNum + 1));

if(centerValue == ‘100’ || centerValue == ‘1010’ || centerValue == ‘1020’)
{
businessUnitValue = ‘00000424’;
}
else if(centerValue == ‘102’ || centerValue == ‘103’ || centerValue == ‘106’ )
{
businessUnitValue = ‘00000421’;
}
else if(centerValue == ‘101’ || centerValue == ‘108’ || centerValue == ‘109’ )
{
businessUnitValue = ‘00000401’;
}
else if(centerValue == ‘704’ || centerValue == ‘AP PL’)
{
businessUnitValue = ‘00000222’;
}
else if(centerValue == ‘104’ || centerValue == ‘105’ || centerValue == ‘107’
|| centerValue == ‘CASPIAN PL’ || centerValue == ‘INTECH KSA’ || centerValue == ‘IRAQ PL’
|| centerValue == ‘MECA PL’ || centerValue == ‘UAE PL’ || centerValue == ‘UAE PnL’)
{
businessUnitValue = ‘00000423’;
}
else if(centerValue == ‘500’ || centerValue == ‘501’ || centerValue == ‘5010’
|| centerValue == ‘502’ || centerValue == ‘5020’ || centerValue == ‘503’
|| centerValue == ‘5030’ || centerValue == ‘504’ || centerValue == ‘5040’
|| centerValue == ‘505’ || centerValue == ‘506’ || centerValue == ‘702’
|| centerValue == ‘711’ || centerValue == ‘712’ || centerValue == ‘713’
|| centerValue == ‘SEN AP PL’ || centerValue == ‘SEN CORP’ || centerValue == ‘SEN FAC’
|| centerValue == ‘SEN OM PL’ || centerValue == ‘SEN US PL’ || centerValue == ‘SENSYS’)
{
businessUnitValue = ‘00000425’;
}
if(i == 0)
{
ledgerDimension = conPoke(ledgerDimension, 1, (conPeek(ledgerDimension, 1) +1));
ledgerDimension = conins(ledgerDimension,(conlen(ledgerDimension)+1),’BusinessUnit’);
ledgerDimension = conIns(ledgerDimension,(conLen(ledgerDimension)+1),businessUnitValue);
}
else
{
ledgerDimension = conPoke(ledgerDimension, (i+1),businessUnitValue );
}

ttsBegin;
dimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
custTable.DefaultDimension = dimensionDefault;
custTable.update();
ttsCommit;
info(strFmt(‘ Customer id = %1 , Business Unit = %2’,custTable.AccountNum , businessUnitValue));

}
else
{
info(‘Customer Not Found’);
}
businessUnitValue = ” ;
i = 0;
centerNum = 0;
centerValue = ”;
dimensionDefault = 0;
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s