You can use the feature PPMOD to change the return value which is used to differentiate the GL a/c to be posted to for the same symbolic a/c.
The structure PC205 used in this feature contains a number of fields relating to an employee, one of them being BUKRS - comp.code.
When you go to PE03, select to modify the feature. Then navigate in the menu bar ->GO To->Structure.
This will show the fields of the structure highlighted, which indicates that they are activated for use.
If a field that is available in the structure but not highlighted, - if you need to use it in the decision tree, select the field; save. Then navigate to Feature->generate. This will activate the field. Now you can use the field in the decision table.
Further, if the GL acc is different and determined based on only the comp code only, you do not need to use all the available fields like PA/PSA, etc.in the structure for your decision table.
For your purpose, following are a sample of required lines.
D BUKRS
AAAA D PERSG
AAAA 1 &PPMOD=1
AAAA 2 &PPMOD=3
...
...
BBBB D PERSG
BBBB 1 &PPMOD=2
BBBB 2 &PPMOD=4
...
...
This return value of PPMOD feature is used to determine the posting a/c for the same w/t but for employees belonging to different attributes - here in your case, the comp.code and may be emp.group.
To be able to use this feature's return value you need to tick the check box 'Addt.modification' in the rules part of IMG- Activities ->assign expense a/c, etc. After ensuring it is checked, save the change and go back to a/c's for the symbolic a/c's.
Re: your issue "
posting of payroll results in FI system is picking balance sheet GL of Company Code A instead of Company Code B and Technical Acct is extended for both company code.",
Note the type of a/c (GL a/c or tech a/c) depends on the AAtyp selected for the w/t in the step
Activities->Maintain w/t,s->Define posting characteristics of w/t's-> w/t overview->Posting a w/t
Check what type is used for the problem w/t's. Balance sheet a/c's have txn HRF, and corresponding AATyp is F.