Hi Haitham,
Define both the materials in BOM and use alternative group id and define the priority, strategy as 2, usage probability % of material. As per priority and stock availability reservation get created.
Refer the below document for more clarity.
Concept of Alternative Item group functionality... | SCN
Thanks & Regards,
Ramagiri