What is an Internal Table?
Interior TABLE are utilized to get information from a decent construction for dynamic use in ABAP. Each line in the inward table has a similar field structure. The primary use for inside tables is for putting away and designing information from a data set table inside a program.In this instructional exercise you will learn:
What is a Work Area ?
Workspaces are single columns of information. They ought to have similar organization as any of the inward tables. Handling the information in an inner table each line in turn is utilized.
Distinction Between Internal Table and a Work Area ?
An image says 1,000 words
Kinds of Internal Tables
There are two kinds of inside tables.
Inward tables with HEADER line
Inward tables without HEADER line.
Inward Tables with Header Line
Here the framework consequently makes the workspace.
The workspace has similar information type as inward table.
This workspace is known as the HEADER line
It is here that every one of the progressions or any of the activity on the items in the table are finished. Accordingly, records can be straightforwardly embedded into the table or gotten to from the inside table straightforwardly.
Inner Tables without Header Line :
Here there is no workspace related with the table.
Workspace is to be expressly determined when we want to access such tables.
Consequently these tables can't be gotten to straightforwardly.
Making Internal Tables
There are numerous ways of making an Internal Table. Lets check out at them individually
1.By Using the Type Statement
Allow us now to make an Internal table itab utilizing the TYPE explanation
An inner table itab is made with the design of line.Besides proclaiming the construction of an inward table, the OCCURS proviso likewise characterizes the number of table sections that are kept up with in primary storage(in this case 10). Additional records are worked out to paging region and can impact execution
2.By alluding to another Table
You can make an interior table by alluding to a current table. The current table could be a standard SAP table, a Z table or another inner table.
Language structure-
Populating Internal Tables
Since we have effectively made a few inside tables, let us perceive how would we populate them for certain records. There are different strategies accessible to populate tables
1.Append Data line by line
The principal technique accessible is the utilization of the APPEND articulation.
Utilizing the APPEND explanation we can either add one line from one more workspace to the inside table or we can add one introductory line to the inward table..
Linguistic structure -
Results : ' ' '0'
Starting lines adds a line introduced with the right incentive for its sort to the table. Here , col1 is a person and col2 is a number. Then APPEND starting line, adds a line introduced regarding the information kind of the sections, for example space for col1 and 0 for col2.
2.Using COLLECT articulation
Gather is one more type of articulation utilized for populating the inward tables. By and large COLLECT is utilized while embedding lines into an inner table with novel standard key.
Grammar
Incase of tables with Header line, INTO choice is discarded. Assume there is now a section having a key same as the one you are attempting to add, then another line isn't added to the table, however the numeric fields of both the passages are added and just a single section relating to the key is available. Worth of SY-TABIX is changed to the line of the first passage. Else COLLECT demonstrations like APPEND and SY-TABIX contains the file of the handled line.
3.Using INSERT proclamation
Embed explanation adds a line/workspace to the interior table. You can indicate the situation at which the new line is to be added by utilizing the INDEX condition with the INSERT articulation.
Punctuation
Duplicating Internal Tables
The items in one inner table can be duplicated to one more by utilizing the APPEND LINES or INSERT LINES explanation. A more less difficult way is to usetany of the accompanying syntax's.These duplicate the items in ITAB1 to ITAB2. Incase of inside tables with header line we need to utilize [] inorder to recognize from workspace. Thus, to duplicate items in inner tables with header line the linguistic structure becomes,
Peruse Internal Tables
We are presently acquainted with the production of inner tables and populating them with information. We will presently perceive how would we really utilize the information or recover the information from the inside tables.
1. Utilizing Loop - Endloop
One of the approaches to getting to or perusing the inside table is by utilizing LOOP-ENDLOOP.Here when you express LOOP AT ITABLE, then the inner table ITABLE is perused line by line. You can get to the upsides of the sections for that line during any piece of the LOOP-ENDLOOP structure. The worth of the SY-SUBRC is set to 0, regardless of whether only one record is perused.
2. Utilizing READ
The other technique for perusing the inside table is by utilizing the READ assertion.PunctuationPeruse TABLE