title: SUM through RBDRSEG lines in ABAP Query
body: <p>I am having trouble figuring out where to start/how to get the correct output. 
  I am very new to ABAP coding. I am trying to create an Infoset query and need to do a bit of coding in SQ02.</p>
  
  <p>I have two tables joined - one being RBKP as the <em>header for Invoice Receipts</em> the other is RBDRSEG for the <em>Invoice Document Items</em>.</p>
  
  <p>The query needs to run following some irrelevant parameters/variants, but when it does so it needs to - - - </p>
  
  <p>Look in RBDRSEG for all same Document numbers  RBKP-BELNR EQ RBDRSEG-RBLNR</p>
  
  <p>In doing so RBDRSEG may or may not have multiple line results for each Doc No.</p>
  
  <p>I need to <strong>total the field RBDRSEG-DMBTR for each Doc No. Result</strong>. 
  (If there a 5 lines for a Doc. No.; DMBTR will have a different value for each that need to be totaled)</p>
  
  <p>At this point I need the output to only show (along with other fields in RBKP) <strong>One line with the SUM of the DMBTR field for each Doc. No.</strong></p>
  
  <p>I then need to have another field showing the <em>difference</em> of the Field RBKP - RMWWWR which is the Invoice Total and the Total that was calculated earlier for that Doc. No. for field DMBTR.</p>
  
  <p>If you could help, I would be incredibly grateful.</p>