Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The second loop should not add new entries into the table, but it should rather fill the third column in the table, which was basically populated in the first loop, correct?</p> <p>If this is so, move the second select into the first select, and do it the same way as you do it with table <code>MAKT</code>, namely</p> <pre><code>SELECT SINGLE J_3GEIGNER FROM EQUZ INTO T_REPORT-MAKTX WHERE equnr = eqkt-equnr. </code></pre> <p>But if you want really to keep two loops, you need to use field-symbols in the second loop, like this:</p> <pre><code>FIELD-SYMBOLS: &lt;T_REPORT&gt; LIKE LINE OF T_REPORT. SELECT * FROM EQUZ WHERE equnr IN s_matnr. READ TABLE T_REPORT ASSIGNING &lt;T_REPORT&gt; WITH KEY MATNR = EQUZ-EQUNR. CHECK SY-SUBRC EQ 0. " skip unknown material numbers &lt;T_REPORT&gt;-MAKTX = EQUZ-J_3GEIGNER. ENDSELECT. </code></pre> <p>This way the values from table <code>EQUZ</code> will be added to the proper record in the internal table <code>T_RECORD</code>.</p> <p>Btw, one additional hint: do not use <code>OCCURS</code>, rather declare the tables explicitly. In your case it should be like this:</p> <pre><code>DATA: BEGIN OF S_report, matnr LIKE eqkt-equnr, mtart LIKE eqkt-eqktx, maktx LIKE equz-J_3GEIGNER, END OF S_report, T_REPORT like standard table of S_REPORT. </code></pre> <p>Of course, then you can't use header line, but use <code>S_REPORT</code> as work-area and for instance write <code>APPEND S_RECORD TO T_RECORD</code> instead of <code>APPEND T_RECORD</code> (but it will make your code only better and easier to read and maintain).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload