Not sure what you are asking here. The item group which is assigned in the item master will flow automatically as it is assigned to the item.
It sounds like you are asking how to automatically assign the cost accounting accounts to the row.
If this is the case then you can do it with a formatted search. Here is a post about formatted searches, it is old but still applies http://scn.sap.com/thread/1579223