Hi ,
your query is not possible in standard,but you can try with user exit"USER EXIT SAVE DOCUMENT PREPARE"
with the help of ABAPER create a Z table with these combination of materials
when ever maintain line item with main material 'A' in sales order call the Z table based on material group and change the item category to TANN.
check the fields-VBAP-MATKL and VBAP-PSTYV..
Regards,
Krishna.