Assuming you have Group 1 on 'Line' and Group 2 on 'BOM', you can try this:
1) Suppress the Details Section
2) Create a formula with this code and place it on the Group Footer 2 (which is the BOM group). This shows the Amount for each BOM:
WhilePrintingRecords;
numbervar bom1;
numbervar bom2 := bom2 + {BOMAmt};
bom1 := bom1 + bom2;
bom2;
3) Create a formula with this code and place it on the Group Footer 1 (which is the Line group). This displays the Amoint for each Line:
WhilePrintingRecords;
numbervar bom1;
4) Create a formula with this code and place it on the Group Header 2:
WhilePrintingRecords;
numbervar bom2 := 0;
"";
5) Create a formula with this code and place it on the Group Header 1:
WhilePrintingRecords;
numbervar bom1 := 0;
"";
6) To show LineAmt + Calculated BOM, create another formula and place this on the GF1:
EvaluateAfter({@Formula_name_on_GroupFooter1});
numbervar bom1;
bom1 + {LineAmt};
-Abhilash