Hi Guys,
The below code shall help you in pulling Account Distribution allocation factors between the Customer for a PurchaseOrder line.
while select forupdate RecId from sourceDocLine
where
sourceDocLine.SourceDocumentHeader == purchTable.SourceDocumentHeader
join forupdate accDist
where
accDist.SourceDocumentLine == sourceDocLine.RecId &&
accDist.ReferenceRole != AccountingDistributionReferenceRole::Reversing
notexists join revAccDist
where
( revAccDist.ReferenceDistribution == accDist.RecId &&
revAccDist.SourceDocumentLine == sourceDocLine.RecId &&
revAccDist.ReferenceRole == AccountingDistributionReferenceRole::Reversing
)
||
(
revAccDist.ReferenceDistribution == accDist.RecId &&
revAccDist.SourceDocumentLine == sourceDocLine.RecId &&
revAccDist.ReferenceRole == AccountingDistributionReferenceRole::Adjusting
)
{
if (accDist.AllocationFactor == 1.0)
{
continue;
}
allocationFactor += accDist.AllocationFactor;
// Write the your business logic her based on the allocation factor
Note: the First loop would always result with allocation factor 1
if (allocationFactor == 1.0)
{
break ;
}
Hope this help you
Thanks,
Pradeep
The below code shall help you in pulling Account Distribution allocation factors between the Customer for a PurchaseOrder line.
while select forupdate RecId from sourceDocLine
where
sourceDocLine.SourceDocumentHeader == purchTable.SourceDocumentHeader
join forupdate accDist
where
accDist.SourceDocumentLine == sourceDocLine.RecId &&
accDist.ReferenceRole != AccountingDistributionReferenceRole::Reversing
notexists join revAccDist
where
( revAccDist.ReferenceDistribution == accDist.RecId &&
revAccDist.SourceDocumentLine == sourceDocLine.RecId &&
revAccDist.ReferenceRole == AccountingDistributionReferenceRole::Reversing
)
||
(
revAccDist.ReferenceDistribution == accDist.RecId &&
revAccDist.SourceDocumentLine == sourceDocLine.RecId &&
revAccDist.ReferenceRole == AccountingDistributionReferenceRole::Adjusting
)
{
if (accDist.AllocationFactor == 1.0)
{
continue;
}
allocationFactor += accDist.AllocationFactor;
// Write the your business logic her based on the allocation factor
Note: the First loop would always result with allocation factor 1
if (allocationFactor == 1.0)
{
break ;
}
Hope this help you
Thanks,
Pradeep
No comments:
Post a Comment