{
GeneralJournalAccountEntry generalJournalAccountEntry;
DimensionAttributeLevelValueAllView dimAttrView; //View that will display all values for ledger dimensions
DimensionAttribute dimAttr; //Main dimension attribute table
while select generalJournalAccountEntry
{
select DisplayValue from dimAttrView where dimAttrView.ValueCombinationRecId == generalJournalAccountEntry.LedgerDimension //5637149079
join BackingEntityType from dimAttr
where dimAttr.RecId == dimAttrView.DimensionAttribute
&& dimAttr.Name == "BusinessUnit";
// && dimAttr.Name == "Project";
// && dimAttr.Name == "Cutomer";
//{
if(dimAttrView.DisplayValue)
info(strFmt("Business Unit: %1", dimAttrView.DisplayValue));
}
}
}
Another way
static void getDimensionValue(Args _args)
{
DimensionAttributeValueSetStorage dimStorage;
Counter i;
str BusUnit;
;
dimStorage = DimensionAttributeValueSetStorage::find(5637147906); //default dimension value
for (i=1 ; i<= dimStorage.elements() ; i++)
{
if(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == "BusinessUnit")
{
BusUnit = dimStorage.getDisplayValueByIndex(i);
}
}
//return BusUnit;
info(strFmt("%1",BusUnit));
}
Another way
OMOperatingUnit omOperatingUnit;
DimensionFinancialTag dimFinancialTag;
DefaultDimensionView defaultDimensionVWBU, defaultDimensionVWLOB;
ProjTable dimProjTable;
defaultDimensionVWBU.clear();
select crossCompany defaultDimensionVWBU
where defaultDimensionVWBU.DefaultDimension == dimProjTable.DefaultDimension
&& defaultDimensionVWBU.Name == "BU"
&& defaultDimensionVWBU.DisplayValue == omOperatingUnit.OMOperatingUnitNumber;
defaultDimensionVWLOB.clear();
select crossCompany defaultDimensionVWLOB
where defaultDimensionVWLOB.DefaultDimension == dimProjTable.DefaultDimension
&& defaultDimensionVWLOB.Name == "LOB"
&& defaultDimensionVWLOB.DisplayValue == dimFinancialTag.Value;
class ExportSalesOrderCostCentreMissing
{
public static void main(Args _args)
{
DimensionAttributeValueSetStorage dimStorage;
SalesTable
salesTable;
Counter i, totalCount;
boolean
costCenterFound;
while select SalesId, DefaultDimension,CustAccount, SalesType, CustomOrderStatus,RetailChannelTable
from salesTable
where salesTable.SalesStatus != SalesStatus::Invoiced
&& salesTable.DataAreaId == 'uk01'
{
dimStorage = DimensionAttributeValueSetStorage::find(salesTable.DefaultDimension);
costCenterFound = false;
for (i = 1 ; i <=
dimStorage.elements() ; i++)
{
if(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == "CostCentre")
{
costCenterFound = true;
}
}
if (costCenterFound == false)
{
Info(strFmt("Sales Id %1 Customer account %2 Order type %3 Channel %4
Twc status %5", salesTable.SalesId,
salesTable.CustAccount, enum2Str(salesTable.SalesType),
salesTable.getRetailChannelName(), salesTable.CustomOrderStatus));
totalCount++;
}
}
}
}
No comments:
Post a Comment