SAP R/3

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.

How to Assign Dynamic Fields using Filed-Symbols in ABAP/4

You can create field name in run time and assign the created name in your field-symbols by statement "ASSIGN ... TO ...".

Example


DATA: name(20),
lv_check(1).

DATA: BEGIN OF itab OCCURS 0,
fld1(4),
fld2(4),
END OF itab.
FIELD-SYMBOLS .
...
...
LOOP AT itab.
IF lv_check = ’X’.
name = ’ITAB-FLD1’.
ELSE.
name = ’ITAB-FLD2’.
ENDIF.
ASSIGN (name) TO .

You can get run time of your program by insert ABAP statement

If you want to know how much the run time of your program by insert ABAP statement, you can insert command "GET RUN TIME" in the top and bottom of program block and minus two times.

Example


DATA: time1 TYPE I,
time2 TYPE I,
runtime TYPE I.
GET RUN TIME FIELD time1.
.....
...program statement...
.....
GET RUN TIME FIELD time2.
runtime = time2 - time1.

How to Insert or Delete Comment Block in ABAP Editor

Insert Comment

Select the statement line as block by hi-light and select menu Utilities -> Block/buffer -> Insert comment * in table control mode) or use hot key Ctrl + < in textedit control mode.

Delete Comment

Select the statement line as block by hi-light and select menu Utilities -> Block/buffer -> Delete comment * in table control mode) or use hot key Ctrl + > in textedit control mode.

How to Upload and Download Source Code of ABAP/4

Upload Source Code from PC File to ABAP Editor

You can do it by select Utilities -> More utilities -> Upload/download -> Upload and then enter your pc file that want to upload in your ABAP editor. Finally, select action ’Copy’.

Download Source Code from ABAP Editor to PC File

You can do it by select Utilities -> More utilities -> Upload/download -> Download and then enter your pc file that want to download from your ABAP editor. Finally, select action ’Copy’.

Function Key Standard Setting in SAP

Function Keys    Description
F1 Help
F2 Choose
F3 Back (One Step)
F4 Possible Entries
F9 Select
F10 Jump to menu bar
F11 Save/Generate
F12 Cancel
F13 Print
F14 Delete
F17 Open
F21 First Page
F22 Previous Page
F23 Next Page
F24 Last Page