Education Presentation ABAP Week-7
Education Presentation ABAP Week-7
Su INTERNAL TABLE
02
Su WORK AREA
03
Su APPEND VALUES
04
Su LOOP AT ITAB
05
C
Fixed Length
N
X
String P
XString Data Type Description Default Length Default Value
C Character 1 ‘‘
Complex N Numeric 1 0
Types D Date 8 0
Structure
T Time 6 0
Type
X Hexadecimal 1 X’0′
Table Type
I Integer 4 0
P Packed 8 0
F Float 8 0
LOCAL DATA TYPES
Work areas are single rows of data. They should • Here the system automatically creates the work area.
have the same format as any of the internal tables. It • The work area has the same data type as internal table.
is used to process the data in an internal table one • This work area is called the HEADER line.
line at a time. • It is here that all the changes or any of the action on the
contents of the table are done. As a result of this, records
can be directly inserted into the table or accessed from the
WHAT IS INTERNAL TABLE ? internal table directly.
C
Structured data type is grouping of several N
simple data types under one name.
D
--------------------------------------------------
Populating Internal
Table
*Work Area.
data: wa type student_type.
*Internal Table.
data itab type table of student_type.
wa-id = '01'.
MOVE 'HAMAD AHMAD' to wa-name.
wa-age = '18'.
append wa to itab.
clear: wa.
write:/ wa-id,
/ wa-name, Classical Report
/ wa-age.
uline.
endloop. (see the above Code). Observe
WRITE: 'Total Number of Records: ', sy-tabix. the code and test in your program.
Assignment
-------------------------------------------------- --------------------------------------------------
MOVE itab1 To itab2. DELETE ITAB
--------------------------------------------------
OR
This statement works only within a loop. It deletes the current
itab1 = itab2. line. You can delete the lines in a loop conditionally by adding
-------------------------------------------------- the WHERE clause.
These copy the contents of ITAB1 to ITAB2. Incase of internal
tables with header line we have to use [] in order to Deleting lines using the index.
distinguish from work area. So, to copy contents of internal
tables with header line the syntax becomes. This is used to delete a line from internal table at any know
-------------------------------------------------- index.
itab1[] = itab2[].
-------------------------------------------------- --------------------------------------------------
DELETE ITAB INDEX <IDX>
--------------------------------------------------
The line with the index <IDX> is deleted. The index of the
following line is decremented by 1.
Reading Internal
Table
SORT ITAB
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING
FIELDNAME.
------------------------------------------------- --------------------------------------------------
SORT ITAB [ASCENDING|DESCENDING]
COMPARING ALL FIELDS is the default. If we do not specify the COMPARING
addition, then the system compares all the fields of both the lines. If we
OR specify fields in the COMPARING clause, then the system compares only
the fields specified after COMPARING of both the lines. If at least one line is
SORT ITAB BY FIELDNAME [ASCENDING|DESCENDING] deleted, the system sets SY-SUBRC to 0, otherwise to 4.
-------------------------------------------------
We can also initialize the internal table using FREE, CLEAR and REFRESH
statements. CLEAR and REFRESH just initializes the internal table where as
FREE initializes the internal table and releases the memory space.
Roll Numbers Roll No.
ABAP-E-3-2-110
Student Name
Muhammad Nawaz
ABAP-E-3-2-259 Asma Shahzad
ABAP-E-3-2-459 Hamza Qayoom
ABAP-E-3-2-144 Muhammad Ismail Zia
ABAP-E-3-2-37 Adeel Saeed
ABAP-E-3-2-343 Saad Mehmood
ABAP-E-3-2-159 Muhammad Awais Aleem
ABAP-E-3-2-168 Muhammad Ayub
ABAP-E-3-2-452 Muhammad Farooq
ABAP-E-3-2-191 Arslan Mazhar
ABAP-E-3-2-451 Waqar Hussain Shahid
ABAP-E-3-2-197 Danish Gul
ABAP-E-3-2-340 Qayyum Ahsan
ABAP-E-3-2-254 Hafiz Muhammad Abubkar
ABAP-E-3-2-397 Umar Farooq
ABAP-E-3-2-398 Mateen Munir
ABAP-E-3-2-400 Fahad Khalid
ABAP-E-3-2-401 Zain ulabdeen
ABAP-E-3-2-357 Muhammad Abubakar Saeed
ABAP-E-3-2-377 Aniya Raees
ABAP-E-3-2-413 Abdul Ahad
ABAP-E-3-2-204 Muhammad Ubaidullah
ABAP-E-3-2-418 Hassan Zulfiqar
ABAP-E-3-2-349 Syed Zia Ud Din Ahmed
ABAP-E-3-2-407 Wajid Yousaf
Roll Numbers Roll No.
ABAP-M-2-1-12
Student Name
Muhammad Jhanzaib
ABAP-M-2-1-208 Taimur Ul Hassan Ghouri
ABAP-M-2-1-294 Maryam Arshad
ABAP-M-2-1-310 Faisal Yasin
ABAP-M-2-1-461 Malik Omer
ABAP-M-2-1-1 Syed Ali Mubashar Kazmi
ABAP-M-2-1-85 Mughees Ahmed Mirza
ABAP-M-2-1-9 Sher Ali
ABAP-M-2-1-31 Muhammad Hamid
ABAP-M-2-1-35 Umer Munir
ABAP-M-2-1-447 Kamil Humayun Mirza
ABAP-M-2-1-148 Nadeem Saleem
ABAP-M-2-1-332 Usman Anwar
ABAP-M-2-1-43 Hafiz Muhammad Ishtiaq
ABAP-M-2-1-47 Zain Khawar
ABAP-M-2-1-50 Hamza Amjad
ABAP-M-2-1-52 Muhammad Raza Liaqat
ABAP-M-2-1-62 Hassan Arif
ABAP-M-2-1-82 Rizwan Saeed Khawaja
ABAP-M-2-1-226 Usama Azeem
ABAP-M-2-1-211 Muhammad Faizan Razzaq
ABAP-M-2-1-104 Safi Ur Rehman
ABAP-M-2-1-84 Hafiz Muhammad Naveed
ABAP-M-2-1-330 Muhammad Sumair
ABAP-M-2-1-395 Muhammad Hussain
For feedback, please write at
Thank you!