Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8539245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:19:06+00:00 2026-06-11T11:19:06+00:00

I have an internal table itab which has some rows that one component of

  • 0

I have an internal table itab which has some rows that one component of the rows matnr is empty. I want to check the palet column of the internal table and get matnr according to palet from the zlldet table, and then change the matnr column of internal table to new matnr value. Here is a summary;

itab table:

+-------+-------+-----------+
| palet | matnr | something |
+-------+-------+-----------+
|  1234 | null  | abc       |
|  1235 | null  | saa       |
|  1236 | null  | ssd       |
+-------+-------+-----------+

So, I will check the palet column from the zlldet table and find the matnr value of that row. The new itab values should be:

+-------+--------+-----------+
| palet | matnr  | something |
+-------+--------+-----------+
|  1234 | 543213 | abc       |
|  1235 | 988876 | saa       |
|  1236 | 344545 | ssd       |
+-------+--------+-----------+

What I’ve tried:

LOOP AT itab.
  SELECT SINGLE matnr INTO itab-matnr
    FROM zlldet WHERE palet = itab-palet.
  ENDIF.
ENDLOOP.

I am trying to change the value in the second line. I know it is wrong, I should use some MODIFY statement but I’m not sure how.

Edit:

Here is the complete 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 <> 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.   

So, what I want to do is exactly: if sharkod includes D, zzldet should be checked for the matnr.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:19:07+00:00Added an answer on June 11, 2026 at 11:19 am

    When you want to do it with modify and not with a field symbol, that would be the correct solution:

    LOOP AT itab.
      SELECT SINGLE matnr INTO itab-matnr
        FROM zlldet WHERE palet = itab-palet.
      MODIFY itab.
    ENDLOOP.
    

    You declared itab as a table with header line (which is deprecated, by the way). That means you have a table itab and a structure itab. Which one is used in which situation depends on context, and some commands, like LOOP AT and MODIFY, use both at the same time. This would be the code with a work area instead of a header line. It’s more readable.

    DATA itab TYPE TABLE OF [something].
    DATA wa TYPE [something].
    
    LOOP AT itab INTO wa.  " copies each line into wa
      SELECT SINGLE matnr INTO wa-matnr
        FROM zlldet WHERE palet = itab-palet.
      MODIFY itab FROM wa.  " writes the changed line back to the table
    ENDLOOP.
    

    You can also use the solution with a field symbol vwegert described. A field symbol is a pointer to the line of the table. Any changes to the field symbol will be automatically written back to the table, so you don’t need MODIFY in this case. It is also faster, especially with very wide tables, because no data needs to be copied.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some internal link which shows different content. Everytime I click the internal
Say I have a Companies table which has a many-many relationship with an Employees
I have user subscriptions in my DB, and the SUBSCRIPTIONS table has UID (that
We have a log table that has a message column that sometimes has an
I have few tables that gather data for internal use but i want to
i have a specifix path like C://asd , an internal table itab, and a
We have built an internal tool that generates the whole data access, each table
I have an internal class A that does a lot of stuff and I
We have an internal asp.net forms app where one page is essentially a WYSIWYG
I have an internal WPF client application that accesses a database. The application is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.