How to Operate with Internal table for Single Line in ABAP/4

If you want to operate work area with internal table, you can operate follow on below statements:

  • APPEND Statement: If you want to append work area to internal table, you can apply this statement.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
APPEND lw_bkpf TO it_bkpf.
  • COLLECT Statement: If attribute of character string is not equal with same field in your work area, this statement operate look like append statement. If attribute of character string is equal with same field in your work area, this statement operate add the value of numeric (P, F, I).
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
COLLECT lw_bkpf INTO it_bkpf.
  • INSERT Statement: Insert statement is look like append statement, but you can specify the index that you want to insert.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
INSERT lw_bkpf INTO it_bkpf INDEX 3.
  • MODIFY Statement: You can modify the data line of internal table by this statement.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
MODIFY it_bkpf INDEX 2 FROM lw_bkpf.
  • DELETE Statement: You can delete the data line of internal table by this statement.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
DELETE it_bkpf INDEX 2.
DELETE it_bkpf WITH KEY BELNR = ’1000000001’.
  • READ Statement: You can access to the data line of internal table by this statement.
    Example

DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
READ TABLE it_bkpf INDEX 2 INTO lw_bkpf.
READ TABLE it_tab INTO lw_bkpf WITH key BELNR = ’1000000001’.

me sea

living black with my had berries. I started places that

Post new comment