Your SlideShare is downloading. ×
97102 abap internal_tables
97102 abap internal_tables
97102 abap internal_tables
97102 abap internal_tables
97102 abap internal_tables
97102 abap internal_tables
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

97102 abap internal_tables

1,295

Published on

abap

abap

Published in: Education, Business, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,295
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
114
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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 Tables1data: 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 YYLOOP AT itab. write: / sy-tabix, itab-f1, itab-f2.ENDLOOP.WRITE: / done. sy-tabix =, sy-tabix, / sy-subrc =, sy-subrc.OUTPUTS:7 A XX8 B YY9 C YYDone 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.

×