title: SELECT bestseller books from DB
body: <p>I'm new on ABAP, and I'm trying to get the &quot;best seller&quot; products, so, I need to do a SUM with a GROUP BY product ID, I'm trying by this way but it doesn't work:</p>
  <pre><code>SELECT SUM(CANTIDAD) into (suma) FROM ZVENTAS_DETALLE GROUP BY ID_PRODUCTO.
  </code></pre>
  <p>Any help? thanks</p>
  <p><strong>UPDATE</strong></p>
  <p>Now, I'm trying to do this with Inner Join to show Product NAme and Total Sales, So, I have this code:</p>
  <pre><code>SELECT SUM( CANTIDAD ) vd~ID_PRODUCTO prd~STOCK_PRODUCTO
    INTO CORRESPONDING FIELDS OF TABLE tabla
    FROM ZVENTAS_DETALLE AS vd
    INNER JOIN ZPRODUCTOS AS prd ON prd~ID_PRODUCTO = vd~ID_PRODUCTO
    GROUP BY vd~ID_PRODUCTO.
    LOOP at tabla into ven.
      WRITE:/ ven~PRODUCTO_NOMBRE.
    ENDLOOP.
  </code></pre>
  <p>So, I get this error
  <a href="https://i.stack.imgur.com/uAJtC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uAJtC.png" alt="enter image description here" /></a></p>
  <p>Could you help me? Thanks</p>