SlideShare a Scribd company logo
ABAP/4
          Internal Tables
• Internal Table
   – Temporary table stored in RAM on
     application server (not on GUI)
   – Created & filled during execution of program
   – Consists of one or more rows with identical
     structure.
   – Identical to a field string declaration
• Consist of a body & optional header
  line.
   – Body holds the rows of data
       • Defined using the occurs n
   – Header line holds current row being
     retrieved or added to the table.
       • Automatically created using begin of…
       • Using like will not create header line.
       • Nested internal table does not have header line
ABAP/4
         Internal Tables
1data: BEGIN OF itab1 OCCURS 10,
        f1,
        f2,
        f3,
      END OF itab1.
data itab2 LIKE ztxlfa1 OCCURS 100.
data itab3 LIKE ztxlfa1 OCCURS 100
                with header line.

•BEGIN OF creates header
•LIKE does not create a header line
•LIKE add WITH HEADER LINE creates
      a header line.
ABAP/4
          Internal Tables
• Adding data to an Internal Table
   – APPEND [wa TO] itab.
       • Wa must have same structure as row of body
         (Explicit work area)
       • After APPEND sy-tabix is set to the relative row
         number of row just appended.
   – APPEND itab to itab is identical to
   – APPEND itab. (Default header line –implicit
     work area)
   – APPEND INITIAL LINE TO itab
       • Appends a row containing initial values (blanks
         & zeros)
       • Same as CLEAR ITAB
       •          APPEND ITAB
ABAP/4
        Internal Tables
• Using the OCCURS addition:
  – OCCURS 10 does not limit the
    number of rows.
  – The system uses the OCCURS
    clause as a guideline to determine
    how much memory to allocate.
  – More is allocated if needed.
  – By default use OCCURS 0 – The
    system then allocates 8 KB of
    memory at run time.
ABAP/4
            Internal Tables
  • Reading Data from an Internal
    Table:
     – LOOP AT
         • Reads multiple rows from an internal
           table into a work area..
                       f1      f2
               1       A       XX
  Itab         2       B       YY
               3       C       YY

LOOP AT itab.
        write: / sy-tabix, itab-f1, itab-f2.
ENDLOOP.
WRITE: / 'done. sy-tabix =', sy-tabix,
          / '     sy-subrc =', sy-subrc.
OUTPUTS:
7 A XX
8 B YY
9 C YY
Done sy-tabix =   99
     sy-subrc =    0
ABAP/4
        Internal Tables
• Restricting rows read from an
  internal table.
   – Using FROM, TO and WHERE
      • WHERE returns a subset but always
        performs a full table scan!.
   – LOOP AT itab WHERE f2= ‘YY’
   – LOOP AT itab from 2 to 3.
• Use EXIT, CONTINUE or CHECK
  to control LOOP AT.

More Related Content

Similar to 97102 abap internal_tables

Best SAP ABAP Training Institute with Placement in Pune | Aspire
Best SAP ABAP Training Institute with Placement in Pune | AspireBest SAP ABAP Training Institute with Placement in Pune | Aspire
Best SAP ABAP Training Institute with Placement in Pune | Aspire
Aspire Techsoft Academy
 
Aspire it sap abap training
Aspire it   sap abap trainingAspire it   sap abap training
Aspire it sap abap training
Aspire Techsoft Academy
 
Internal tables
Internal tablesInternal tables
Internal tableswaseem27
 
(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memory(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memory
Nico Ludwig
 
Abap performance tunning tips
Abap performance tunning tipsAbap performance tunning tips
Abap performance tunning tips
Jay Dalwadi
 
45 ways to speed up firebird database
45 ways to speed up firebird database45 ways to speed up firebird database
45 ways to speed up firebird database
Fabio Codebue
 
CNIT 127: Ch 2: Stack overflows on Linux
CNIT 127: Ch 2: Stack overflows on LinuxCNIT 127: Ch 2: Stack overflows on Linux
CNIT 127: Ch 2: Stack overflows on Linux
Sam Bowne
 
127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux
Sam Bowne
 
Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013
Getting value from IoT, Integration and Data Analytics
 
Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013
Cloudera, Inc.
 
Howmysqlworks
HowmysqlworksHowmysqlworks
Howmysqlworks
mysqldbahelp
 
Internal tables
Internal tables Internal tables
Internal tables
Jibu Jose
 
Introduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptxIntroduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptx
abuadu
 
CNIT 127: Ch 2: Stack Overflows in Linux
CNIT 127: Ch 2: Stack Overflows in LinuxCNIT 127: Ch 2: Stack Overflows in Linux
CNIT 127: Ch 2: Stack Overflows in Linux
Sam Bowne
 
127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux
Sam Bowne
 
Sap internal
Sap   internalSap   internal
Sap internalkyashpal
 
Sap abap
Sap abapSap abap
Sap abap
nrj10
 
Tuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBaseTuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBase
Anil Gupta
 

Similar to 97102 abap internal_tables (20)

Best SAP ABAP Training Institute with Placement in Pune | Aspire
Best SAP ABAP Training Institute with Placement in Pune | AspireBest SAP ABAP Training Institute with Placement in Pune | Aspire
Best SAP ABAP Training Institute with Placement in Pune | Aspire
 
Aspire it sap abap training
Aspire it   sap abap trainingAspire it   sap abap training
Aspire it sap abap training
 
05 internal tables
05 internal tables05 internal tables
05 internal tables
 
Internal tables
Internal tablesInternal tables
Internal tables
 
(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memory(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memory
 
Abap performance tunning tips
Abap performance tunning tipsAbap performance tunning tips
Abap performance tunning tips
 
45 ways to speed up firebird database
45 ways to speed up firebird database45 ways to speed up firebird database
45 ways to speed up firebird database
 
CNIT 127: Ch 2: Stack overflows on Linux
CNIT 127: Ch 2: Stack overflows on LinuxCNIT 127: Ch 2: Stack overflows on Linux
CNIT 127: Ch 2: Stack overflows on Linux
 
127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux
 
Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013
 
Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013
 
Howmysqlworks
HowmysqlworksHowmysqlworks
Howmysqlworks
 
Internal tables
Internal tables Internal tables
Internal tables
 
Introduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptxIntroduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptx
 
CNIT 127: Ch 2: Stack Overflows in Linux
CNIT 127: Ch 2: Stack Overflows in LinuxCNIT 127: Ch 2: Stack Overflows in Linux
CNIT 127: Ch 2: Stack Overflows in Linux
 
Excel tips
Excel tipsExcel tips
Excel tips
 
127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux
 
Sap internal
Sap   internalSap   internal
Sap internal
 
Sap abap
Sap abapSap abap
Sap abap
 
Tuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBaseTuning Apache Phoenix/HBase
Tuning Apache Phoenix/HBase
 

Recently uploaded

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
ShivajiThube2
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 

Recently uploaded (20)

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
JEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questionsJEE1_This_section_contains_FOUR_ questions
JEE1_This_section_contains_FOUR_ questions
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 

97102 abap internal_tables

  • 1. ABAP/4 Internal Tables • Internal Table – Temporary table stored in RAM on application server (not on GUI) – Created & filled during execution of program – Consists of one or more rows with identical structure. – Identical to a field string declaration • Consist of a body & optional header line. – Body holds the rows of data • Defined using the occurs n – Header line holds current row being retrieved or added to the table. • Automatically created using begin of… • Using like will not create header line. • Nested internal table does not have header line
  • 2. ABAP/4 Internal Tables 1data: BEGIN OF itab1 OCCURS 10, f1, f2, f3, END OF itab1. data itab2 LIKE ztxlfa1 OCCURS 100. data itab3 LIKE ztxlfa1 OCCURS 100 with header line. •BEGIN OF creates header •LIKE does not create a header line •LIKE add WITH HEADER LINE creates a header line.
  • 3. ABAP/4 Internal Tables • Adding data to an Internal Table – APPEND [wa TO] itab. • Wa must have same structure as row of body (Explicit work area) • After APPEND sy-tabix is set to the relative row number of row just appended. – APPEND itab to itab is identical to – APPEND itab. (Default header line –implicit work area) – APPEND INITIAL LINE TO itab • Appends a row containing initial values (blanks & zeros) • Same as CLEAR ITAB • APPEND ITAB
  • 4. ABAP/4 Internal Tables • Using the OCCURS addition: – OCCURS 10 does not limit the number of rows. – The system uses the OCCURS clause as a guideline to determine how much memory to allocate. – More is allocated if needed. – By default use OCCURS 0 – The system then allocates 8 KB of memory at run time.
  • 5. ABAP/4 Internal Tables • Reading Data from an Internal Table: – LOOP AT • Reads multiple rows from an internal table into a work area.. f1 f2 1 A XX Itab 2 B YY 3 C YY LOOP AT itab. write: / sy-tabix, itab-f1, itab-f2. ENDLOOP. WRITE: / 'done. sy-tabix =', sy-tabix, / ' sy-subrc =', sy-subrc. OUTPUTS: 7 A XX 8 B YY 9 C YY Done sy-tabix = 99 sy-subrc = 0
  • 6. ABAP/4 Internal Tables • Restricting rows read from an internal table. – Using FROM, TO and WHERE • WHERE returns a subset but always performs a full table scan!. – LOOP AT itab WHERE f2= ‘YY’ – LOOP AT itab from 2 to 3. • Use EXIT, CONTINUE or CHECK to control LOOP AT.