Hi Elham,
With this BADI - BBP_BS_GROUP_BE and method - GROUP_RS_BACKEND, you can do the grouping for a single shopping cart which I am aware of.
Kindly refer the below wiki links for your further reference
Shopping Cart Splitting and Grouping - Supplier Relationship Management - SCN Wiki
Best Regards,
Bharathi