title: Why INSERT into internal table fails?
body: <p>I have a Problem with ABAP. I have the following code from a book:</p>
  
  <pre><code>METHOD make_reservation.
    DATA: license_plate     TYPE zcars-license_plate,
          reservation_wa    LIKE LINE OF reservation_tab,
          reservation_num   TYPE i,
          mess              TYPE string.
  
    reservation_num = lines( reservation_tab ).
  
    SELECT license_plate FROM zcars INTO (license_plate) WHERE category = category.
  
      LOOP AT reservation_tab
        TRANSPORTING NO FIELDS
        WHERE license_plate = license_plate
        AND NOT ( date_from &gt; date_to OR date_to &lt; date_from ).
  
      ENDLOOP.
  
      IF sy-subrc &lt;&gt; 0.
        reservation_wa-reservation_id   = reservation_num + 1.
        reservation_wa-customer_id      = customer.
        reservation_wa-license_plate    = license_plate.
        reservation_wa-date_from        = date_from.
        reservation_wa-date_to          = date_to.
  
        INSERT reservation_wa INTO TABLE reservation_tab.
        IF sy-subrc &lt;&gt; 0.
          CONCATENATE license_plate ' reserved!' INTO mess.
          MESSAGE mess TYPE 'I'.
        ELSE.
          MESSAGE 'internal error!' TYPE 'I' DISPLAY LIKE 'E'.
          LEAVE PROGRAM.
        ENDIF.
  
        RETURN.
      ENDIF.
    ENDSELECT.
  
    RAISE EXCEPTION TYPE zcx_no_car_available.
  
  ENDMETHOD.
  </code></pre>
  
  <p>the problem is the line <code>INSERT reservation_wa INTO TABLE reservation_tab.</code> which does not run correctly and I always get <code>sy-subrc &lt;&gt; 0</code>. This results to the message "internal error!"</p>
  
  <p><strong>now my question:</strong> I tired to debug it, but I cant find the reason why this statement does not insert the data. How can I find out a detailed error message what went wrong with this SQL statement?</p>