title: Data didn't show in the first row and start to calculate from second (ABAP,BW)
body: <p>Can you help me with ABAP code (I make some simple logic for BW).</p>
  <p>When data is appended to the table, it calculates the first row, but writes the result in the second, second to third, etc. And on the first row I have zero result.</p>
  <p>What can it be? Can you help me, please, maybe I lost something in my code.</p>
  <p><img src="https://i.stack.imgur.com/dWgHh.png" alt="Picture with my problem" /></p>
  <p>My code:</p>
  <pre><code>      FIELD-SYMBOLS:   &lt;ls_data&gt;       TYPE any,
                   &lt;lv_plant&gt;     TYPE /BI0/OIPLANT.   
        TYPES: begin of    ty_kpi_result,
           plant           type  /BI0/OIPLANT,
           mat_num_01(18)  type  n,
           mat_num_02(18)  type  n,    
      END OF ty_kpi_result.
  
  
      DATA: lt_result        TYPE TABLE OF ty_kpi_result,
          ls_result        like LINE OF lt_result,
          lv_count         type i,
          lv_plant_1       type /BI0/OIPLANT.   
      sort ct_data ASCENDING.  
      LOOP AT ct_data ASSIGNING &lt;ls_data&gt;.
      ASSIGN COMPONENT 'PLANT' OF STRUCTURE &lt;ls_data&gt; to &lt;lv_plant&gt;.
       * lv_count             = lv_count + 1.
        ls_result-plant      = &lt;lv_plant&gt;.
      IF lv_plant_1        = &lt;lv_plant&gt;.
         lv_count             = lv_count + 1.
          ls_result-mat_num_01 = lv_count.
      ELSE.
        lv_count = 0.
        lv_count = lv_count + 1.
  
  
      APPEND ls_result to lt_result.
      ENDIF.
  
      lv_plant_1 = &lt;lv_plant&gt;.
      ls_result-mat_num_01 = lv_count.  
   ENDLOOP.
  </code></pre>