title: Filling itab value from another itab
body: <p>I have an internal table <code>itab</code> which has some rows that one component of the rows <code>matnr</code> is empty. I want to check the <code>palet</code> column of the internal table and get <code>matnr</code> according to <code>palet</code> from the <code>zlldet</code> table, and then change the <code>matnr</code> column of internal table to new <code>matnr</code> value. Here is a summary;</p>
  
  <p><code>itab</code> table:</p>
  
  <pre><code>+-------+-------+-----------+
  | palet | matnr | something |
  +-------+-------+-----------+
  |  1234 | null  | abc       |
  |  1235 | null  | saa       |
  |  1236 | null  | ssd       |
  +-------+-------+-----------+
  </code></pre>
  
  <p>So, I will check the <code>palet</code> column from the <code>zlldet</code> table and find the <code>matnr</code> value of that row. The new <code>itab</code> values should be:</p>
  
  <pre><code>+-------+--------+-----------+
  | palet | matnr  | something |
  +-------+--------+-----------+
  |  1234 | 543213 | abc       |
  |  1235 | 988876 | saa       |
  |  1236 | 344545 | ssd       |
  +-------+--------+-----------+
  </code></pre>
  
  <hr>
  
  <p>What I've tried:</p>
  
  <pre><code>LOOP AT itab.
    SELECT SINGLE matnr INTO itab-matnr
      FROM zlldet WHERE palet = itab-palet.
    ENDIF.
  ENDLOOP.
  </code></pre>
  
  <p>I am trying to change the value in the second line. I know  it is wrong, I should use some <code>MODIFY</code> statement but I'm not sure how.</p>
  
  <p><strong>Edit:</strong> </p>
  
  <p>Here is the complete code:</p>
  
  <pre><code>REPORT zwps0510 MESSAGE-ID zc LINE-SIZE 255 NO STANDARD PAGE HEADING.
  TABLES: zzllog, zzldet, marc, makt.
  DATA: BEGIN OF itab OCCURS 0.
      INCLUDE STRUCTURE zzllog.
  DATA: END OF itab.
  
  DATA: adet TYPE p.
  */ paket numaraları
  SELECT-OPTIONS: spalet FOR zzllog-palet.      "/paket no
  SELECT-OPTIONS: spaleta FOR zzllog-paleta.    "/paketnoa
  SELECT-OPTIONS: spaletb FOR zzllog-paletb.    "/paketnob
  SELECTION-SCREEN SKIP 1.
  */ paketle ilgili bilgiler
  SELECT-OPTIONS: sdispo FOR marc-dispo.
  SELECT-OPTIONS: smatnr FOR zzllog-matnr.
  SELECT-OPTIONS: sharkod FOR zzllog-harkod.    "/logtaki işlem kodu
  *SELECT-OPTIONS: stelf1 FOR zzllog-telf1.
  SELECT-OPTIONS: starih FOR zzllog-tarih.
  SELECT-OPTIONS: susr FOR zzllog-usr.
  SELECT-OPTIONS: saufnr FOR zzllog-aufnr.
  SELECTION-SCREEN SKIP 1.
  */ depo adres bilgileri
  SELECT-OPTIONS: sflgnum FOR zzllog-flgnum.    "/kaynak depo no
  SELECT-OPTIONS: sflgtyp FOR zzllog-flgtyp.    "/kaynak depo tipi
  SELECT-OPTIONS: sflgpla FOR zzllog-flgpla.    "/kaynak depo numarası
  SELECT-OPTIONS: stlgnum FOR zzllog-tlgnum.    "/hedef depo no
  SELECT-OPTIONS: stlgtyp FOR zzllog-tlgtyp.    "/hedef depo tipi
  SELECT-OPTIONS: stlgpla FOR zzllog-tlgpla.    "/hedef depo numarası
  SELECTION-SCREEN SKIP 1.
  */ Çıktıda gelecek kolonların seçimi
  SELECTION-SCREEN BEGIN OF BLOCK uc WITH FRAME TITLE text-001.
  PARAMETERS : tarih AS CHECKBOX DEFAULT 'X',
           saat AS CHECKBOX DEFAULT 'X',
           usr AS CHECKBOX DEFAULT 'X',
           palet AS CHECKBOX DEFAULT 'X',
           paleta AS CHECKBOX DEFAULT 'X',
           paletb AS CHECKBOX DEFAULT 'X',
           harkod AS CHECKBOX DEFAULT 'X',  "/ hareket kodu
           matnr AS CHECKBOX DEFAULT 'X',
           menge AS CHECKBOX DEFAULT 'X',
           sebep AS CHECKBOX DEFAULT 'X',  "/ sipariş/red
           aufnr AS CHECKBOX DEFAULT 'X',  "/sm.siparişi
           ref2 AS CHECKBOX DEFAULT 'X',
           paufnr AS CHECKBOX DEFAULT 'X', "/enj.siparişi
           flgnum AS CHECKBOX DEFAULT 'X', "/from depo...
           flgtyp AS CHECKBOX DEFAULT 'X',
           flgpla AS CHECKBOX DEFAULT 'X',
           tlgnum AS CHECKBOX DEFAULT 'X', "/ to depo...
           tlgtyp AS CHECKBOX DEFAULT 'X',
           tlgpla AS CHECKBOX DEFAULT 'X'.
  SELECTION-SCREEN END OF BLOCK uc.
  *
  TOP-OF-PAGE.
     PERFORM baslik.
  *
  START-OF-SELECTION.
    PERFORM prepare_itab.
    PERFORM write_itab.
  **
  FORM prepare_itab.
  */ Paketle ilgili tüm geçmiş hareketler log tablosundan okunur
    SELECT * INTO CORRESPONDING FIELDS OF TABLE itab
        FROM zzllog WHERE palet IN spalet
                      AND paleta IN spaleta
                      AND paletb IN spaletb
                      AND matnr IN smatnr
                      AND harkod IN sharkod
                      AND tarih IN starih
                      AND flgnum IN sflgnum
                      AND flgtyp IN sflgtyp
                      AND flgpla IN sflgpla
                      AND tlgnum IN stlgnum
                      AND tlgtyp IN stlgtyp
                      AND tlgpla IN stlgpla
                      AND aufnr IN saufnr
                      AND usr IN susr.
    IF sdispo[] IS NOT INITIAL.
      LOOP AT itab.
        SELECT SINGLE dispo INTO marc-dispo
                  FROM marc WHERE matnr = itab-matnr
                              AND werks = '3001'
                              AND dispo IN sdispo.
        IF sy-subrc &lt;&gt; 0.
          DELETE itab.
        ENDIF.
      ENDLOOP.
    ENDIF.
  
  
  
  
    DESCRIBE TABLE itab LINES adet.
  */ tüm hareketler tarih ve saate göre sıralanır
   SORT itab BY tarih saat.
   WRITE:/ 'ADET: ', adet.
   ULINE.
     ENDFORM.   
  </code></pre>
  
  <p>So, what I want to do is exactly: if <code>sharkod</code> includes <code>D</code>, <code>zzldet</code> should be checked for the <code>matnr</code>.</p>