Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views4 pages

Internal Operations Code

The document outlines operations on internal tables in ABAP, including defining a structure for employee data and performing various operations such as appending, inserting, deleting, modifying, sorting, and reading records. It demonstrates how to manage employee records with specific attributes like ID, name, date of birth, address, and salary. The document also includes examples of outputting the results of these operations.

Uploaded by

gurulakshminallu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Internal Operations Code

The document outlines operations on internal tables in ABAP, including defining a structure for employee data and performing various operations such as appending, inserting, deleting, modifying, sorting, and reading records. It demonstrates how to manage employee records with specific attributes like ID, name, date of birth, address, and salary. The document also includes examples of outputting the results of these operations.

Uploaded by

gurulakshminallu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

TYPES: BEGIN OF emp_str,

emp_id TYPE zemployee001-emp_id,


emp_name TYPE zemployee001-emp_name,
emp_dob TYPE zemployee001-emp_dob,
emp_add TYPE zemployee001-emp_add,
emp_salary TYPE zemployee001-emp_salary,
END OF emp_str.

DATA : it_emp TYPE TABLE of emp_str,


it_emp1 TYPE TABLE of emp_str,
wa_emp TYPE emp_str.

"Internal Table Operations - Append


wa_emp-emp_id = '1A'.
wa_emp-emp_name = 'krishna'.
wa_emp-emp_dob = '20001206'.
wa_emp-emp_add = 'banglore'.
wa_emp-emp_salary = 2000.
APPEND wa_emp to it_emp.
clear wa_emp.
out->write( it_emp ).

wa_emp-emp_id = '2A'.
wa_emp-emp_name = 'latha'.
wa_emp-emp_dob = '20010908'.
wa_emp-emp_add = 'hyderabad'.
wa_emp-emp_salary = 3000.
APPEND wa_emp to it_emp.
clear wa_emp.
" Append Multiple records
APPEND LINES OF it_emp TO it_emp1.
out->write( it_emp1 ).

"Insert
wa_emp-emp_id = '1B'.
wa_emp-emp_name = 'subash'.
wa_emp-emp_dob = '20051002'.
wa_emp-emp_add = 'chandigarh'.
wa_emp-emp_salary = 4000.
INSERT wa_emp INTO it_emp1 INDEX 2.
clear wa_emp.

wa_emp-emp_id = '1C'.
wa_emp-emp_name = 'siri'.
wa_emp-emp_dob = '20020617'.
wa_emp-emp_add = 'tirupati'.
wa_emp-emp_salary = 3000.
INSERT wa_emp INTO it_emp1 INDEX 3.
clear wa_emp.
out->write( it_emp1 ).

"Insert multiple records


INSERT LINES OF it_emp1 FROM 2 to 3 INTO it_emp INDEX 2.
clear wa_emp.
out->write( it_emp ).

" Delete the record from a location


DELETE it_emp INDEX 3.
out->write( it_emp ).
"Delete <INTERNAL TABLE NAME> from <N1> TO <N2>.
DELETE it_emp FROM 2 to 3.
out->write( it_emp ).

"Delete internal table data based on a condition


DELETE it_emp where emp_dob = '20051002'.
out->write( it_emp ).

"Modify Single field of a record


wa_emp-emp_salary = '2500'.
MODIFY it_emp FROM wa_emp TRANSPORTING emp_salary where emp_id = '1A' .
out->write( it_emp ).

"Modify Multiple fields of a record


wa_emp-emp_name = 'bhavana'.
wa_emp-emp_add = 'vizag'.
MODIFY it_emp FROM wa_emp TRANSPORTING emp_name emp_add where emp_id =
'2A'.
out->write( it_emp ).

"Describe
DESCRIBE TABLE it_emp LINES data(L_COUNT).

"Sort
SORT it_emp by emp_salary. "ASCENDING
out->write( it_emp ).

SORT it_emp by emp_salary DESCENDING.


out->write( it_emp ).
"Refresh
refresh it_emp.
out->write( it_emp ).

"Clear
clear wa_emp.
out->write( wa_emp ).

"Free
free wa_emp.
out->write( wa_emp ).

"Loop....endloop
LOOP AT it_emp into wa_emp FROM 2 to 3.
out->write( wa_emp ).
ENDLOOP.

"Read Table
READ TABLE it_emp INTO wa_emp INDEX 4.
out->write( wa_emp ).

READ TABLE it_emp INTO wa_emp WITH KEY emp_add = 'hyderabad' BINARY
SEARCH.
out->write( wa_emp ).

You might also like