append / insert / modify / delete / read / clear / refresh / sort

 https://www.youtube.com/watch?v=NGsAYkoqDGQ



REPORT zdxc_internal_table_operations.

TYPESBEGIN OF st_emp,
         empno(10TYPE c,
         dept(10)  TYPE c,
         empna(20TYPE c,
         sal       TYPE i,
         city(10)  TYPE c,
         cntr(5)   TYPE c,
       END OF st_emp.

DATAit_emp TYPE STANDARD TABLE OF st_emp,
      wa_emp TYPE st_emp.

wa_emp-empno '5'.
wa_emp-dept 'SAP5'.
wa_emp-empna 'Iash5'.
wa_emp-sal '90005'.
wa_emp-city 'delphi5'.
wa_emp-cntr 'india5'.
insert wa_emp into it_emp index 1.

wa_emp-empno '1'.
wa_emp-dept 'SAP'.
wa_emp-empna 'Iash'.
wa_emp-sal '9000'.
wa_emp-city 'delphi'.
wa_emp-cntr 'india'.
append wa_emp to it_emp.


wa_emp-empno '2'.
wa_emp-dept '1C'.
wa_emp-empna 'Meghna'.
wa_emp-sal '92000'.
wa_emp-city 'delphi'.
wa_emp-cntr 'india'.
append wa_emp to it_emp.

wa_emp-empno '3'.
wa_emp-dept '4C'.
wa_emp-empna 'Me4a'.
wa_emp-sal '97700'.
wa_emp-city '1с'.
wa_emp-cntr 'china'.
append wa_emp to it_emp.

wa_emp-empno '7'.
wa_emp-dept '7C'.
wa_emp-empna 'Me7a'.
wa_emp-sal '777'.
wa_emp-city '7с'.
wa_emp-cntr '7china7'.
modify it_emp from wa_emp index TRANSPORTING empno dept sal.

sort it_emp by empno city descending .

*DELETE it_emp index 1.
*DELETE it_emp from 2 to 3.

*READ table it_emp into wa_emp index 2.
*READ table it_emp into wa_emp with table key empno = '10'.


*clear it_emp.   "dont release memory
*refresh it_emp. "dont release memory

cl_demo_output=>displayit_emp ).
cl_demo_output=>displaywa_emp ).

Comments

Popular posts from this blog

sap abap import from excell to table (transparent table)

sap abap Import from excell to internal table that works 100%