LedgerRowDefDesigner Form

Hi All,

Can anyone tell me why this code is used in the executeQuery() of LedgerRowDef datasource.

query = new Query();

qbDataSource = query.addDataSource(tablenum(LedgerRowDef));

dimensionTopicsPrioritizer = DimensionTopicsPrioritizer::newDimensionSetId(lrDef.MainFocus);

dimensionTopic = dimensionTopicsPrioritizer.lastDimensionTopic();

maxLedgerRowDefPriority = dimensionTopicsPrioritizer.dimensionTopic2Priority(dimensionTopic);

ledgerRowDefLineBuffer.RowDefinition = lrDef.RowDefinition;

while select ledgerRowDefBuffer


if((ledgerRowDefSetup.Hierarchy && (!ledgerRowDefBuffer.Hierarchy || !ledgerRowDefBuffer.isUpdatedAndApproved())) ||

(!ledgerRowDefSetup.Hierarchy &&

ledgerRowDefBuffer.Hierarchy &&





for(i = 1; i <= maxLedgerRowDefPriority; i++)


ledgerRowDefLineBuffer.Priority = i;

if(LedgerRowDefLine::checkRefRowStructure(ledgerRowDefLineBuffer, ledgerRowDefBuffer))


qbDataSource.addRange(fieldnum(LedgerRowDef, RowDefinition)).value(queryValue(ledgerRowDefBuffer.RowDefinition));

foundAvailableStructure = true;





qbDataSource.addRange(fieldnum(LedgerRowDef, RowDefinition)).value(SysQuery::valueEmptyString());


Actually I am opening the structure designer for an hierarchy and I am getting an error like,

SQL error description: [Microsoft][ODBC SQL Server Driver][SQL Server]Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.

The reason for this error is the above code. I can see it is taking into account all the hierarchies belong to the set and adding them as range in the italicized and underlined code . But I couldn’t find the reason.

Even if I comment this code, I could not see any difference in the process.

Please help me find out the use of this code.

Many Thanks,

Bharath C G.