title: Get total without LOOP based on SAP system table
body: <p>I am trying to summarise specific fields in my table that are based on a system table ekbe. Here is how I started:</p>
  <pre><code>REPORT zz_program3.
  TABLES: ekbe.
  
  TYPES: BEGIN OF tt_mati1,
  ebeln LIKE ekbe-ebeln,
  ebelp LIKE ekbe-ebelp,
  bewtp LIKE ekbe-bewtp,
  bwart LIKE ekbe-bwart,
  menge LIKE ekbe-menge,
  suma1 TYPE i,
  END OF tt_mati1.
  
  DATA: lt_mati1 TYPE STANDARD TABLE OF tt_mati1 WITH KEY elebn ebelp.
  
  SELECT *
  FROM ekbe
  INTO CORRESPONDING FIELDS OF TABLE lt_mati1
  WHERE ( bewtp = 'E' AND bwart = '101' ).
  </code></pre>
  <p>Now, I want to sum all fields that will occur, for example:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>EBELN</th>
  <th>EBELP</th>
  <th>BEWTP</th>
  <th>BWART</th>
  <th>MENGE</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>450001122</td>
  <td>01</td>
  <td>E</td>
  <td>101</td>
  <td>5,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>01</td>
  <td>E</td>
  <td>101</td>
  <td>1,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>01</td>
  <td>E</td>
  <td>101</td>
  <td>1,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>02</td>
  <td>E</td>
  <td>101</td>
  <td>1,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>02</td>
  <td>E</td>
  <td>101</td>
  <td>2,000</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>And I would like to have something like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>EBELN</th>
  <th>EBELP</th>
  <th>BEWTP</th>
  <th>BWART</th>
  <th>MENGE</th>
  <th>SUMA1</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>450001122</td>
  <td>01</td>
  <td>E</td>
  <td>101</td>
  <td>5,000</td>
  <td>7,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>01</td>
  <td>E</td>
  <td>101</td>
  <td>1,000</td>
  <td>7,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>01</td>
  <td>E</td>
  <td>101</td>
  <td>1,000</td>
  <td>7,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>02</td>
  <td>E</td>
  <td>101</td>
  <td>1,000</td>
  <td>3,000</td>
  </tr>
  <tr>
  <td>450001122</td>
  <td>02</td>
  <td>E</td>
  <td>101</td>
  <td>2,000</td>
  <td>3,000</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I know I have to use FOR GROUPS and REDUCE functions but unfortunately I do not know how to implement this in internal table based on system table.</p>
  <p>Can anyone help me with solving?</p>