The consolidation dimension is set by the dataunit.
Origin member Elimination can only be used, if the business rule runs in the c#elimination dataunit.
Typically you run it in the
Case Is = FinanceFunctionType.ConsolidateElimination
section of the Finance Business rule (or better in a sub-procedure).
So you only need to set the origin dimension:
O#Elimination
or
TargetCell.DataBufferCellPk.OriginId = dimconstants.Elimination
By the way, there is also an "api.ExecuteDefaultElimination" command, that runs the intercompany elimination for you.