according to what I've found out...
The offset account has a segmented value, if you're going to pass a string/text to it, it must be placed in a container.
offsetContainer =[ MainAccount, MainAccount, *Number of Dimensions*, *Name of the Dimension*, *Value of the Dimension*, ... ];
... - means more can be added.
Disregard the asterisks ().*
The first two segments are the MainAccount (I am really not sure on the first segment, please correct me if I am wrong. But I've researched about it and it has a different value than the second, in my case I used the same value as the second segment and it worked for me.), then the next is the Number of Dimensions. This is the number of segments that you're going to place a value after the MainAccountId, then the Name of the Dimensions is name of the segment. Lastly, the Value of the Dimension this is the value you're going to assign to the dimension you just named.
So here's an example of a segment.

and here is how you will code the container:
offsetContainer = [ 1101006,
1101006,
5,
'BudORProject',
'00',
'Local_OverSeas',
'00',
'ProfitCenter',
'0000',
'Hub',
'000'
];
So since there are 5 more segments after the MainAccount, 5 is the value for the Number of Dimensions. *
Now using it on your code:
AxLedgerJournalTrans trans = new AxLedgerJournalTrans();
trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetcon));
Don't forget to use AxdDimensionUtil::getLedgerAccountId method where you will place the container, as seen above.